Giter Club home page Giter Club logo

userpage_nodejs's Introduction

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.

userpage_nodejs's People

Contributors

soheelgadad avatar

Stargazers

Sairaj Satarkar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.