As we know HTTP is a stateless protocol, i.e it doesn’t stores any data. There are many cases where we have to store the user data to keep track of the user, here comes the use of sessions. When the client requests a server for any piece of data for the first time, the server creates a session for that user.
How to implement sessions in Express Js
First of all, install the necessary packages using the command given below :
Everytime the page you will refresh the views increase unless the server is restarted.
Note: The above code is just for understanding the sessions, in production level applications you need to be careful while using sessions and cookies.