The session module for PXE.js
Install @pxe/session
.
# NPM
npm i @pxe/session
# Yarn
yarn add @pxe/session
Session
Create a session instance.
session.invoke
ctx: Context
:next: NextFunction
:...args: any[]
:The callback of the session middleware. This can be used as a middleware:
app.use(session.invoke.bind(router));
// Or shorter
app.use(session);
Store the sessions. The default session store can cause memory leaks.
Store
Create a new session store.
sessionStore.save
data: any
: Data to be storedid: string
: The idSave data and id to sessionStore matching id.
sessionStore.get
id: string
: The idGet the sessionStore.
sessionStore.destroy
id: string
: The idDestroy the sessionStore.