tezvyn:

cookie-parser: From Header String to Usable Object

Source: expressjs.comintermediate

The cookie-parser middleware translates the raw Cookie header string into a usable `req.cookies` object. It's used in Express apps to read session IDs or user preferences.

The cookie-parser middleware translates the raw Cookie header string into a usable `req.cookies` object for your Express routes. It's essential for any app that reads cookie values for sessions or user preferences. By passing a secret string, it also enables signed cookies, moving validated ones to `req.signedCookies` for tamper detection. The footgun: a tampered signed cookie's value becomes `false` in `req.signedCookies`, not the tampered string or null, which requires specific handling in your code.

Read the original → expressjs.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

cookie-parser: From Header String to Usable Object · Tezvyn