express session cookie code example
Example 1: npm express-session
npm i express-session //On Hyper/CMD
const session = require('express-session'); //To Acquire it
app.use(session({ //Usuage
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
cookie: { secure: true }
}));
Example 2: experss cookie session
var cookieSession = require('cookie-session')
var express = require('express')
var app = express()
app.use(cookieSession({
name: 'session',
keys: [/* secret keys */],
// Cookie Options
maxAge: 24 * 60 * 60 * 1000 // 24 hours
}))