Cookies are simple, small files/data that are sent to the client with a server
request and stored on the client side. Every time the user loads the website back, this cookie is sent with the request. This helps us keep track of the user’s actions.
The following are the numerous uses of HTTP Cookies −
Session management
Personalization(Recommendation systems)
User tracking
To use cookies with Express, we need the cookie-parser middleware. To
install it, use the following code −
npm install --save cookie-parser
Now to use cookies with Express, we will require the cookie-parser package.
cookie-parser looks at the headers in between the client and the server transactions, reads these headers, parses out the cookies being sent, and saves them in a browser. In other words, cookie-parser will help us create and manage cookies depending on the request a user
makes to the server.