A full-featured blogging application built using Node.js, Express, MongoDB, and EJS. The app allows users to register, log in, create blog posts, and manage their own content securely. Only authenticated users can create, edit, or delete their own posts, ensuring multi-role integrity and secure access control.
- 📝 User Registration & Login
- 🔐 Session-based Authentication via
express-session - 🔒 Password Hashing with
bcryptfor secure storage - ✍️ Create, Read, Update, and Delete Posts
- 🧑💻 Authorization:
- Only the original author can edit/delete their own blog posts
- 🛡️ Protected Routes using custom middleware
- 📄 EJS Templates for dynamic server-side rendering
- 💬 Flash messages for user feedback (if implemented)
- Node.js – Backend runtime
- Express.js – Server framework
- EJS – Templating engine for rendering views
- MongoDB Atlas – Cloud database
- Mongoose – MongoDB ODM for schema modeling
- express-session – Session handling and login persistence
- bcrypt – Secure password hashing
- CSS – Basic styling
git clone https://github.com/your-username/blog-platform.git
cd blog-platformnpm installCreate a .env file in the root directory with the following:
MONGODB_URI=your_mongodb_atlas_connection_string
SESSION_SECRET=your_secure_session_secretnpm startVisit http://localhost:3000 in your browser.
- ✅ Only logged-in users can create blog posts.
- ✏️ Only the post's author can edit or delete their own posts.
- ❌ Unauthorized users attempting to access protected routes are redirected or blocked.