I use express.session with connect-mongo to store user sessions. I set cookie maxAge to 2 weeks from now, but what I want is that if the user is active within those 2 weeks, the session extends to another 2 weeks, so that when he is inactive for 2 weeks his session gets deleted (both the cookie and the session in mongo). But the problem is that the session gets updated in MongoDB when he visits a page, but the cookie will expire in 2 weeks and won't change it's 'expires'. This is my code:
app.use(express.session({
secret: 'superSecretKey',
cookie: {maxAge: 3600000*24*14},
store: new MongoStore({
mongoose_connection: mongoose.connections[0],
db: 'myDb'
})
}));
How can I achieve what I want? Thanks!