SessionsMiddleware
Uses HTTP cookies to save and restore sessions for connecting clients.
final class SessionsMiddleware
If a cookie matching the configured cookie name is found on an incoming request, the value will be used as an identifier to find the associated Session
.
If a session is used during a request (Request.session()
), a cookie will be set on the outgoing response with the session’s unique identifier. This cookie must be returned on the next request to restore the session.
app.middleware.use(app.sessions.middleware)
See SessionsConfig
and Sessions
for more information.