In most ExpressJs example, I found using cookie-parser
with express-session
.
If I could access session data with req.session.name
without it, in what case ( or benefits ) should I be using cookie-parser
?
In most ExpressJs example, I found using cookie-parser
with express-session
.
If I could access session data with req.session.name
without it, in what case ( or benefits ) should I be using cookie-parser
?
For future humble coders, that will stumble upon this - I'm posting an up-to-date answer:
As the official description of
express-session
middleware says here: express-sessionTherefore, just use express-session middleware and have a nice day.
In addition to providing simple cookie parsing functionality, the
cookie-parser
middleware enables signed cookies which can be referenced by other middleware components, using an optionalsecret
attribute.Why would you want signed cookies? This question addresses that well