Skip to content

Instantly share code, notes, and snippets.

@laniltee
Created October 26, 2018 15:43
Show Gist options
  • Save laniltee/ee0a6fca5a17422efe093e7b928d88f2 to your computer and use it in GitHub Desktop.
Save laniltee/ee0a6fca5a17422efe093e7b928d88f2 to your computer and use it in GitHub Desktop.
Log out js
// Signs out and clear the session ID with CSRF token
app.post('/logout', (req, res) => {
const sessionID = req.cookies['session-id'];
delete SESSION_IDS[sessionID];
console.log(sessionID + ': Removed');
res.clearCookie("session-id");
res.clearCookie("time");
res.sendFile('views/login.html', {root: __dirname});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment