I am new with Express
. As Express 4.x
has removed bundled middlewares.
Any middleware I want to use should be required. When I read the README with exp
express-session
stores the session identifier in the cookie while the actual session data resides in backend session store like connect-redis
, where as cookie-session
allows you to store the session data in a cookie (client-side).
From the documentation of cookie-session
:
A user session can be stored in two main ways with cookies: on the server or on the client. This module stores the session data on the client within a cookie, while a module like express-session stores only a session identifier on the client within a cookie and stores the session data on the server, typically in a database.
The main advantage of using cookie-session
is when you have a clustered node.js
app, then you don't have to rely on sharing session data between forked processes.