A simple Node.js application for user registration and login using Express, MongoDB, bcrypt, JWT, and EJS.
- User registration with hashed passwords
- User login with JWT authentication
- EJS templating for views
- Cookie-based session management
- Logout functionality
- Node.js
- Express.js
- MongoDB (with Mongoose)
- bcrypt
- jsonwebtoken
- EJS
-
Clone the repository:
git clone https://github.com/daniyalkhan5499/UserAuthentication.git cd UserAuthentication -
Install dependencies:
npm install
-
Set up your MongoDB connection in
models/user.js(update the URI as needed). -
Start the application:
node app.js
-
Open your browser and go to http://localhost:3000
UserAuthentication/
│
├── app.js
├── models/
│ └── user.js
├── views/
│ ├── index.ejs
│ └── login.ejs
├── public/
│ └── ...static files...
└── package.json
- Register a new user at
/ - Login at
/login - Logout at
/logout
This project is licensed