protectApi(client:MonoCloudBackendNodeClient,options?:ProtectApiRequestOptions<FastifyRequest<RouteGenericInterface,RawServerDefault,IncomingMessage,FastifySchema,FastifyTypeProviderDefault,unknown,FastifyBaseLogger,ResolveFastifyRequestType<FastifyTypeProviderDefault,FastifySchema,RouteGenericInterface>>>):ProtectHook
Creates a Fastify onRequest hook factory for protecting API routes using a pre-configured client.
| Parameter | Type | Description |
|---|---|---|
client | MonoCloudBackendNodeClient | A pre-configured MonoCloudBackendNodeClient instance. |
options? | ProtectApiRequestOptions<FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, FastifySchema, FastifyTypeProviderDefault, unknown, FastifyBaseLogger, ResolveFastifyRequestType<FastifyTypeProviderDefault, FastifySchema, RouteGenericInterface>>> | Options for extracting tokens and certificates from the request. |
protectApi(options?:ProtectApiRequestOptions<FastifyRequest<RouteGenericInterface,RawServerDefault,IncomingMessage,FastifySchema,FastifyTypeProviderDefault,unknown,FastifyBaseLogger,ResolveFastifyRequestType<FastifyTypeProviderDefault,FastifySchema,RouteGenericInterface>>>):ProtectHook
Creates a Fastify onRequest hook factory for protecting API routes.
A new MonoCloudBackendNodeClient is created from the provided options, or from environment variables.
| Parameter | Type | Description |
|---|---|---|
options? | ProtectApiRequestOptions<FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, FastifySchema, FastifyTypeProviderDefault, unknown, FastifyBaseLogger, ResolveFastifyRequestType<FastifyTypeProviderDefault, FastifySchema, RouteGenericInterface>>> | Options for extracting tokens and certificates from the request. |