Skip to content

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 ​

Container

context ​

RequestContext

reply? ​

HttpReply

The reply, so a guard can set response headers (e.g. Retry-After) before rejecting. Optional: a pipeline may run guards without one.

request ​

HttpRequest

route ​

BasaltRoute

Returns ​

void | Promise<void>

Released under the MIT License.