Sean H
Sean H

Reputation: 89

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 :)

Upvotes: 3

Views: 1553

Answers (1)

Sean H
Sean H

Reputation: 89

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

Upvotes: 2

Related Questions