In newer versions of express, middle-wares like session are not bundled with express. Furthermore, if you want to use them, then you have to install them separately. like :
npm install express-session
and then require it :
var session = require('express-session');
and then use this:
app.set('trust proxy', 1) // trust first proxy
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
cookie: { secure: true }
}))