getLocals
The locals of the request being handled.
The locals of the request being handled. Available wherever getRequestEvent is (middleware,
guards, loaders, API routes and server functions) on runtimes with AsyncLocalStorage.
Import#
ts
import { getLocals } from "@shadow-js/dusk/server";
Signature#
ts
function getLocals(): DuskLocals
Returns#
The request's locals.
Throws#
- DuskError when there is no request or no async context (see
getRequestEvent).
Examples#
ts
const user = getLocals().user;