basalt / fastify/src / RouteGuard
Type Alias: RouteGuard
> RouteGuard = (info) => void | Promise<void>
Defined in: http/src/pipeline.ts:47
Runs after enrichers, with access to the route definition (and its meta). Plugins register guards in the 'http:guards' metadata bucket — auth uses meta.auth, permissions uses meta.can. A guard rejects by throwing.
Parameters
info
container
context
reply?
The reply, so a guard can set response headers (e.g. Retry-After) before rejecting. Optional: a pipeline may run guards without one.
request
route
Returns
void | Promise<void>