- NodeJs For Backend and server support
- ExpressJs To create server
- NodeMailer To Send mails and OTP from the server
- MySQL To interact with MySQL database
- Crypto To Generate Hashed Passwords
- Morgan For Server log support in case of failure
- Config : contains the database connectivity and configuration related files
- Model : contains utilities related to db tables and passwords
- Public : contains stylesheets ans illustrations to be served from the server
- Routes : contains routing informations
- Views: contains templates to be served by server
- Public : contains stylesheets ans illustrations to be served from the server
In order to run the application make sure you have a database users_db created into mysql after creating the database please follow the steps
- Please clone this repository using git clone and cd into the directory
- Inside .env file please update your mysql username and password
- open terminal inside the directory and npm install to insatll all the dependencies
- npm start to start the development server
- Cheers you've setup the project and the server is up and running
- User can register using the credentials and the password is encrypted before storing into the database
- User can login using the email and a OTP is sent to the specified mail ( Here I am using nodemailers Test Account to send mails) however in production environment we can use API's like SendGrid or MailGun
- OTP is sent and the otp can be viewed at by the address wriiten on the terminal
- User enters the OTP and the Dashboard is rendered indicating succesfull login
- Server logs in case server crashes , that can be helpful to find the fault
GET: localhost:3000/
This is the first page that is rendered when the user makes its first request to the server
GET: localhost:3000/login
This is the login page that is rendered when the user makes its request for login to the server
GET: localhost:3000/otp
This is the login page that is rendered when the user makes its request for entering the otp to the server
Dashboard Page when User is Authenticated
This is the dashboard page rendered by the server
POST: localhost:3000/register The body the register request contains the following
{
"username" : "<Enter Your User name here>",
"email" : "<Enter your mail here>",
"password " : "<Enter your password here>",
"phone" : "<Enter the phone number here>"
}
POST: localhost:3000/login The body the login request contains the following
{
"email" : "<Enter your mail here>",
}
POST: localhost:3000/otp The body the otp request contains the following
{
"email" : "<Enter your mail here>",
"otp" : "<Enter the otp here>"
}