User authentication & authorization is one of the important part of any web application. There are several kinds of way to handle authentication, we can rely on third party service like Passport. But in this article we will use very simple & self developed approach, which will help us to understand core part of authentication.

Image for post

Prerequisite

Node

Express

Nodemon

Technology Used

Database: MySQL

Password Hash: bcryptjs

Token: JWT

Basic Structure

To create basic structure for different kind of endpoints like registration or login we will use express as router. And we will create a folder for routers.

In routes folder we will create a file auth.js for authentication related routes.

#nodejs #mysql #authentication #web-development #expressjs

Authentication and Authorization in NodeJS
7.15 GEEK