Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog App

A simple blog application built with Express.js, MongoDB, and Passport.js authentication.

Features

  • User registration and login authentication
  • Create, read, update, and delete blog posts
  • Session management
  • Responsive UI with EJS templates

Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB
  • Authentication: Passport.js (Local Strategy)
  • Frontend: EJS, CSS
  • Session: Express-session

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd blog-app
  2. Install dependencies:

    npm install
  3. Make sure MongoDB is running on your system

  4. Start the server:

    npm start
  5. Open your browser and navigate to http://localhost:3000

Usage

  1. Register: Create a new account with email and address
  2. Login: Sign in with your credentials
  3. Create Blog: Write and publish new blog posts
  4. View Blogs: See all blog posts from all users
  5. Edit/Delete: Manage your own blog posts
  6. Logout: Sign out of your account

Project Structure

blog-app/
├── models/           # Database schemas (User, Blog)
├── routes/           # Route handlers (auth, blogs)
├── views/            # EJS template files
├── public/           # Static files (CSS, images)
├── config/           # Configuration files (Passport)
├── app.js            # Main application file
├── package.json      # Dependencies
└── README.md         # This file

Routes

  • GET / - Home page
  • GET /register - Registration page
  • POST /register - Register new user
  • GET /login - Login page
  • POST /login - Login user
  • GET /logout - Logout user
  • GET /blogs - View all blogs
  • GET /blogs/new - Create blog form
  • POST /blogs - Create new blog
  • GET /blogs/:id/edit - Edit blog form
  • PUT /blogs/:id - Update blog
  • DELETE /blogs/:id - Delete blog

Notes

  • MongoDB must be running locally or connection string must be updated
  • Passwords are currently stored as plain text (not hashed) - implement bcrypt for production
  • Session data is stored in memory (use MongoDB store for production)

License

ISC

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages