nodejs express set cookie code example
Example 1: set cookie in node
res.setHeader('Set-Cookie','visited=true; Max-Age=3000; HttpOnly, Secure');
Example 2: express get cookie
const cookieParser = require('cookie-parser');
const express = require('express');
const app = express();
app.use(cookieParser());
app.get('/', (req, res) => {
console.log('Cookies: ', req.cookies);
console.log('Signed Cookies: ', req.signedCookies);
});
app.listen(3000);