Sign in

Function: protectApi

Call Signature

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.

Parameters

ParameterTypeDescription
clientMonoCloudBackendNodeClientA 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.

Returns

ProtectHook

Call Signature

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.

Parameters

ParameterTypeDescription
options?ProtectApiRequestOptions<FastifyRequest<RouteGenericInterface, RawServerDefault, IncomingMessage, FastifySchema, FastifyTypeProviderDefault, unknown, FastifyBaseLogger, ResolveFastifyRequestType<FastifyTypeProviderDefault, FastifySchema, RouteGenericInterface>>>Options for extracting tokens and certificates from the request.

Returns

ProtectHook

© 2024 MonoCloud. All rights reserved.