Add rolling option on session to reset maxAge on every response to extend session life

This commit is contained in:
Wu Cheng-Han 2016-07-05 16:06:18 +08:00
parent 3c7d39c52d
commit f7a4f8f8c2
1 changed files with 2 additions and 1 deletions

3
app.js
View File

@ -100,9 +100,10 @@ app.use(session({
secret: config.sessionsecret,
resave: false, //don't save session if unmodified
saveUninitialized: true, //always create session to ensure the origin
rolling: true, // reset maxAge on every response
cookie: {
maxAge: config.sessionlife,
expires: new Date(Date.now() + config.sessionlife),
expires: new Date(Date.now() + config.sessionlife)
},
store: sessionStore
}));