In this tutorial, we will do the authentication part of our project “Creating a social networking site in Node JS and Mongo DB”. First we will do the “Hello world” in Node JS, then connect with Mongo DB on localhost. Then we will use EJS module as a templating engine, it is used to design the web pages for Node JS applications.
Our authentication tutorial will include “Login, Registration and Logout”. For registration we are using “bcrypt” module to convert password into secure hash for saving in database. For login we are using “jsonwebtoken” module that will generate an access token for each user. We are also storing this token in localStorage for sending the requests from client side.
We will also teach you to upload files in Node JS and save their path in Mongo DB using “fs” file system module. You will also learn to put validation on input type file on client side and on server side as well, for example while updating profile image make sure the user has selected an image file and not a video or PDF or any other non-supported image file.
#node #node js #mongo db