@quiltjs/quilt
Version:
Lightweight, type-safe handler and router abstraction for Node HTTP servers.
22 lines • 1.48 kB
TypeScript
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import type { HttpContext, ServerEngineAdapter } from '../Quilt.js';
import type { Handler } from '../Handler.js';
/**
* Adapter that implements the ServerEngine interface using Fastify.
*/
export declare class FastifyEngineAdapter implements ServerEngineAdapter<FastifyRequest, FastifyReply> {
private fastify;
constructor({ fastify }: {
fastify: FastifyInstance;
});
post(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
get(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
patch(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
put(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
delete(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
options(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
head(path: string, handler: (req: FastifyRequest, res: FastifyReply) => Promise<void>): void;
}
export type FastifyHttpContext = HttpContext<FastifyRequest, FastifyReply>;
export type FastifyHandler<O = any, D extends Record<string, Handler<any, FastifyHttpContext, any>> = Record<string, Handler<any, FastifyHttpContext, any>>> = Handler<O, FastifyHttpContext, D>;
//# sourceMappingURL=FastifyEngineAdapter.d.ts.map