0 points

Set up Cookies with express-session


dashboard

Tue Apr 28 2020 19:22:18 GMT+0000 (UTC)

Posted by @frogblog #nodejs

                                var app = express()
var sess = {
  secret: 'keyboard cat',
  cookie: {}
}
 
if (app.get('env') === 'production') {
  app.set('trust proxy', 1) // trust first proxy
  sess.cookie.secure = true // serve secure cookies
}
 
app.use(session(sess))
                                
content_copy Copy

https://www.npmjs.com/package/express-session