[Solved] Express-session deprecated undefined resave option; provide resave option app.js

Nodejs express configuration session starts, and the express session cancelled undefined save option appears; provide resave option app.js

Solution:

app.use(session({  
  resave:false,//added 
  saveUninitialized: true,//added   
  secret: settings.cookieSecret,  
  key: settings.db,//cookie name  
  cookie: {maxAge: 1000 * 60 * 60 * 24 * 30},//30 days  
  store: new MongoStore({  
    db: settings.db,  
    host: settings.host,  
    port: settings.port  
  })  
}));  

Similar Posts: