Nodejs API Auth

It validates the user data for registration and login using joi validation and lets user access the home route if they are logedIn with a verified token generated by json wen token.

1
0
JavaScript

Nodejs-API-Auth

Overview

This validates the user data for registration and login using joi validation and lets user access the home route if they are logedIn with a verified token generated by json wen token.

This API has 3 routes :-

  • /api/user/home
  • /api/user/register
  • /api/user/login

Setup Guidlines

STEP 1

git clone https://github.com/payalpatra/Nodejs-API-Auth.git

STEP 2

(Make sure to run this in the root directory)
  npm install

STEP 3

(Create .env file in the root directory with the following Variable)
 DB_CONNECT =mongodb+srv://<USERNAME>:<PASSWORD>@cluster0.ifcel.mongodb.net/<DBNAME>?retryWrites=true&w=majority
 TOKEN_SECRET= thisIsTheToken
  • Starting the server
(Make sure to run this in the root directory)
 nodemon index