SessionManager
Loads sessions and saves them after the request.
Loads sessions and saves them after the request.
Import#
ts
import type { SessionManager } from "@shadow-js/dusk/server";
Signature#
ts
interface SessionManager {
/** The session of `event`, loaded on first use. Needs the middleware to be saved. */
get(event: RequestEvent): Promise<Session>;
/**
* Middleware that saves the session and sets its cookie after the rest of the request ran. It
* saves also when the route failed (`next()` returns the error response), so a login attempt
* counter or a flash message survives a 4xx or 5xx answer.
*/
middleware(): Middleware;
}
Members#
| Name | Type | Description |
|---|---|---|
get |
get(event: RequestEvent): Promise<Session> |
The session of event, loaded on first use. Needs the middleware to be saved. |
middleware |
middleware(): Middleware |
Middleware that saves the session and sets its cookie after the rest of the request ran. It saves also when the route failed (next() returns the error response), so a login attempt counter or a flash message survives a 4xx or 5xx answer. |