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