UNPKG

@pulzar/core

Version:

Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support

53 lines 2.32 kB
import type { FastifyInstance, FastifyRequest, FastifyReply, FastifyPluginAsync, FastifyPluginOptions } from "fastify"; export interface FastifyAdapterOptions { logger?: boolean | any; trustProxy?: boolean | string | string[] | number; disableRequestLogging?: boolean; ignoreTrailingSlash?: boolean; maxParamLength?: number; caseSensitive?: boolean; allowUnsafeRegex?: boolean; requestIdHeader?: string | false; requestIdLogLabel?: string; genReqId?: (req: any) => string; bodyLimit?: number; querystringParser?: (str: string) => Record<string, unknown>; exposeHeadRoutes?: boolean; constraints?: Record<string, any>; } export interface RouteHandler { (request: FastifyRequest, reply: FastifyReply): Promise<any> | any; } export interface RouteOptions { method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS"; url: string; handler: RouteHandler; schema?: { body?: any; querystring?: any; params?: any; headers?: any; response?: Record<number, any>; }; preHandler?: any[]; config?: any; } export declare class FastifyAdapter { private app; constructor(options?: FastifyAdapterOptions); private generateRequestId; private setupDefaults; addRoute(options: RouteOptions): void; addPlugin<TOptions extends FastifyPluginOptions = FastifyPluginOptions>(plugin: FastifyPluginAsync<TOptions>, options?: TOptions): void; addHook(hookName: string, hookHandler: (request: FastifyRequest, reply: FastifyReply, done?: Function) => void | Promise<void>): void; addPreHandler(handler: (request: FastifyRequest, reply: FastifyReply) => Promise<void> | void): void; addErrorHandler(handler: (error: Error, request: FastifyRequest, reply: FastifyReply) => Promise<void> | void): void; getInstance(): FastifyInstance; listen(port: number, host?: string): Promise<string>; close(): Promise<void>; static createPluginFromMiddleware(middlewareFunction: (req: any, res: any, next: any) => void): FastifyPluginAsync; private static createExpressLikeRequest; private static createExpressLikeResponse; } export declare function createFastifyAdapter(options?: FastifyAdapterOptions): FastifyAdapter; //# sourceMappingURL=fastify-adapter.d.ts.map