LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

How do you end a session (log out) in Express.js?

Call req.session.destroy() to delete all of that user's session data on the server.

function (req, res) {
  req.session.destroy();
  // redirect to login page or home
}

This removes all session variables for this user. The session ID cookie may remain but will no longer match any server data. Call this when the user logs out or the session should end.

From Quiz: WEBT / User Sessions | Updated: Jun 20, 2026