How to get cookie value in expressjs

For people that stumble across this question, this is how I did it:

You need to install the express cookie-parser middleware as it’s no longer packaged with express.

npm install --save cookie-parser

Then set it up as such:

const cookieParser = require("cookie-parser");

const app = express();
app.use(cookieParser());

Then you can access the cookies from

req.cookies

Hope that help.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)