I have a function to login
app.post(\'/doLogin\', function(req,res){
db.users.findOne({username: req.body.username}, function(err, user) {
if
Express-session uses the cookie to set or get the session id from the client
as stated on the documentation
Please note that secure: true is a recommended option. However, it requires an https-enabled website, i.e., HTTPS is necessary for secure cookies. If secure is set, and you access your site over HTTP, the cookie will not be set.
Remember the below points:
If you are not hosting on HTTPS connection cookie secure flag should be set to false.
If the you are using a proxy thats hosted on the HTTPS you should set trust proxy to 1. Refer the documentation
cookie: { secure: false }
for example:
app.use(session({
// your settings
cookie: { secure: false }
}))