Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logout function in node & express

I am wondering how to implement the logout function in nodejs using express and express section, the code I wrote is following:

app.get('/logout',function(req, res){
  req.session.destroy(function(){
    res.redirect('/');
  });
}); 

However, when multiple user login, if one of the user logout, everyone else that login will be log out. Can anyone please tell me how to implement this correctly? thanks :)

like image 725
Sean H Avatar asked Sep 28 '26 13:09

Sean H


1 Answers

NVM, I found out that the problem can be resolve by using the destroy(sid, fn) method in session-memory module

like image 108
Sean H Avatar answered Sep 30 '26 02:09

Sean H