Skip to content

This project is about Node.js and user login and signup

License

Notifications You must be signed in to change notification settings

SoheelGadad/Userpage_nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Userpage_nodejs

User Authentication with Express, Bcrypt, and Sessions This is a simple example application that demonstrates user authentication using the Express.js framework, the Bcrypt.js library for password hashing, and the Express-Session middleware for session management.

Getting Started

To get started, clone this repository to your local machine and install the dependencies using NPM:

$ git clone https://github.com/your-username/express-auth-example.git $ cd express-auth-example $ npm install Next, create a new file called .env in the root of the project and add the following environment variables:

makefile Copy code MONGODB_URI= SESSION_SECRET= Replace with the URI for your MongoDB database and with a random string to use as your session secret.

Running the App To run the app, start the development server using the following command:

$ npm start This will start the server on http://localhost:3000.

Routes

The app has the following routes:

/ - the home page /signup - the signup page /login - the login page /dashboard - the dashboard page (requires authentication) /logout - logs out the user and destroys the session User Authentication The app uses Bcrypt to hash and compare passwords, and Express-Session to manage user sessions. When a user signs up, their password is hashed using Bcrypt and stored in the database. When a user logs in, the app compares the hashed password in the database with the hashed password entered by the user. If the passwords match, the user is authenticated and a session is created.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

This project is about Node.js and user login and signup

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published