Skip to main content

Function: createSessionMiddleware()

createSessionMiddleware(mgr): RequestHandler

Defined in: service-core/src/http/session/sessionMiddleware.ts:28

Builds a global, framework-agnostic session middleware backed by the given SessionManager. Lazily loads-or-creates req.session and persists any mutations back to the store once the response finishes. Cheap for requests that never touch sessions: no store round-trip unless a valid session cookie was actually sent, and no Set-Cookie/store write for sessions that end up empty.

Parameters

mgr

SessionManager

Returns

RequestHandler