This module is for implementing Register, Login and Change Password function.
Visit this link to see the demo https://loginmongodb.azurewebsites.net/
Note: It will take 30-40 sec to load if you are viewing first time. This happens because website is deployed on serverless architecture in order to cut the hosting prices.
- Install nodeJS 14 (Click here to download)
- Install MongoDB here. ([Optional] You can instead use MongoDB Atlas if you want.)
- Clone/download the project
- Open the project
- Install all the dependencies by running
npm installin terminal. - Add these environment variables to a .env file on your project root directory.
DB_URL=
PORT=
JWT_SECRET=
DB_URL: In DB_URL you can add mongodb Atlas connection string or you can add local mongodb URL. If you don't know how to generate MongoDB Atlas database URL then follow this tutorial
PORT: Enter port number at which app will run
JWT_SECRET: Enter any long string consist of random characters.
Your final .env should look like this:
DB_URL="mongodb://localhost:27017/login-app-db"
PORT=3000
JWT_SECRET=sejrhernmfnggbxbfasassqkwejwrjqfjb332#$#@gsf@@@qwn
Note: If you still having problem in creating environmental variable then create a .env file in root directory and paste the above code as it is. Make sure you have installed Mongodb on your System.
Execute this command
npm start
If you are modifying or making any changes to this project, Use
npm run dev
It will start project using nodemon server. Each time when you make changes it will restart the server automatically
http://localhost:3000 contain index page eg. Registration Page.
http://localhost:3000/login.html contains Login Page.
http://localhost:3000/change-password.html contains Change Password page
- create User.
- Login User.
- Change Password
- Auth via JWT.
- Resetting password.
- Fork the repo
- Make Changes
- Pull Request
Note: Make sure to check Issue section for Identified Issues
- Nodejs 14
- MongoDB
- Express
- JWT (JsonWebToken)
- bcrypt
- Mongoose
- BodyParser
- path
- dotenv