You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* While sessions with memoryStore may work fine with multiple requests/redirects, external stores can cause race conditions - between next client request and the store, depending on who runs faster. So save the session explicitly, prior to the response/redirect. */
req.session.save(function(err){
if(!err){
res.redirect('/admin');
}
});
// While sessions with memoryStore may work fine with multiple requests/redirects, external
// stores can cause race conditions - between next client request and the store, depending
// on who runs faster. So save the session explicitly, prior to the response/redirect.
req.session.save(function(err){
if(err){
res.end('session save error: '+err)
return
}
res.redirect('/admin')
})
}
});
})
app.get('/admin',function(req,res,next){
console.log(req.session);
res.end('Redirected response');
});
console.log(`in redirected route, views: ${req.session.views} and extra: ${req.session.extra}`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* While sessions with memoryStore may work fine with multiple requests/redirects, external stores can cause race conditions - between next client request and the store, depending on who runs faster. So save the session explicitly, prior to the response/redirect. */