Session
noun
say it: “SESH-un” /ˈsɛʃən/
The information a website keeps about a visitor between page loads, such as who signed in, found again by an id stored in a cookie.
What is a session on a website?
A session is a record the server keeps about one visitor between requests, such as who signed in. The server finds it again from a random session id that the browser sends back in a cookie with every request.
// after a good sign-in
const sessionId = crypto.randomUUID();
sessions.set(sessionId, { userId: 7, signedInAt: Date.now() });
res.cookie("sid", sessionId, { httpOnly: true, secure: true });
In a sentence
- “The session remembers who Rosa is while she moves from page to page.”
- “Signing out deletes the session on the server, so the old cookie stops working.”
Level: Journeyman · More Web Development terms at this level
Updated