Skip to content

Type Alias: GuardHandler<Req> ​

ts
type GuardHandler<Req> = (request, reply, context) => unknown;

Defined in: packages/fastify/src/guards.ts:49

Must send a reply (e.g. reply.code(403).send(...)) or throw (e.g. an httpErrors error). Req is the request it gets: GuardRequest<T> in createGuards<T>(), so request.rbac has the names of T there.

Type Parameters ​

Type ParameterDefault type
ReqFastifyRequest

Parameters ​

ParameterType
requestReq
replyFastifyReply
contextGuardContext

Returns ​

unknown

Released under the MIT License. Inspired by spatie/laravel-permission.