Login System in NodeJS using ExpressJS.
Do check out the wiki to read about the stuff that I learnt through my journey.
You can install all of them using:
$ npm install express sequelize body-parser jsonwebtoken cookie-parser bcrypt
Also, any one of the following according to your needs:
$ npm install --save pg pg-hstore
$ npm install --save mysql2
$ npm install --save sqlite3
$ npm install --save tedious
-
POST /user
: This api will help with user registration process. A user is defined by the following attributes:
a.user_id
(primary_key)
b.first_name
c.last_name
d.email
e.mobile_number
f.password
-
POST /login
: This api will have mobile_number and password as post request body and upon password validation will return JWT. -
GET /user
: This api will be use to get USER details. This API will have authentication policy applied i.e. It will require the client to provide authentication token which can be obtained via login. -
PUT /user
: This api modifies USER attributes like first_name, last_name, password. Rest of the attributes are not modifiable. This API will have authentication policy applied i.e. It will require the client to provide authentication token which can be obtained via login.
ExpressJS
: For restful API development. You will make use of router and middlewaresSequelize (MYSQL)
: For persistence (model) layerPostman
: GUI for making API request.