Type Alias: BeforeHandle
ts
type BeforeHandle = (ctx) => Promise<unknown>;Defined in: packages/elysia/src/guards.ts:88
A guard, used as an Elysia beforeHandle hook: app.get('/x', handler, { beforeHandle: requireRole('admin') }) or app.guard({ beforeHandle: [...] }, (app) => ...). It returns nothing when the check passes, and the response of onUnauthenticated / onForbidden otherwise, which ends the request.
Parameters
| Parameter | Type |
|---|---|
ctx | object |
Returns
Promise<unknown>
