Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between cookie and cookieSession?

What is the difference between cookieSession and cookie in Express?

like image 424
gilbertbw Avatar asked Jun 09 '26 21:06

gilbertbw


1 Answers

The cookieParser middleware parses HTTP Cookie: headers to populate req.cookies (and req.signedCookies if you give it a secret).

The cookieSession middleware adds cookie-based session state.
It depends on the cookieParser middleware to use cookies.

There is no cookie middleware, although there is a cookie package which exposes a utility function that creates or parses cookie strings. The cookieParser middleware uses this package to read & write HTTP headers.

like image 171
SLaks Avatar answered Jun 12 '26 09:06

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!