Creates an in-memory session store.
@eryx/http/ServerSession Module
Summary
Functions
API Reference
Functions
SessionMethods:get
SessionMethods:set
SessionMethods:delete
SessionMethods:clear
SessionMethods:regenerate
SessionMethods:destroy
MemoryStoreMethods:get
MemoryStoreMethods:set
MemoryStoreMethods:delete
MemoryStoreMethods:touch
FileStoreMethods:_pathFor
FileStoreMethods:get
FileStoreMethods:set
FileStoreMethods:delete
FileStoreMethods:touch
SqliteStoreMethods:get
SqliteStoreMethods:set
SqliteStoreMethods:delete
SqliteStoreMethods:touch
ServerSession.memoryStore
Returns
SessionStore
ServerSession.fileStore
Creates a filesystem-backed session store where each session is stored as JSON.
Parameters
Directory used for session files.
Returns
SessionStore
ServerSession.sqliteStore
Creates an SQLite-backed session store.
Parameters
Either a path string or an open @eryx/sqlite3 database.
Optional table name. Defaults to "http_sessions".
Returns
SessionStore
ServerSession.middleware
Creates app middleware that attaches a server-side session to ctx.session.
The middleware loads the session from a cookie before the handler runs and persists it back to the configured store after the handler completes.
Parameters
Session configuration and backing store.
Returns
(ctx: any, next: () -> any) -> any
Types
SessionRecord
SessionStore
SessionCookieOptions
SessionOptions
Session
Returns a value from the session data table.
Sets a value and marks the session dirty for persistence.
Removes a value and marks the session dirty.
Clears all session data.
Assigns a fresh session id and preserves the current data.
Deletes the session from the backing store and clears the cookie.