UNPKG

fastify-file-router

Version:

A fastify plugin that automatically registers routes from files in a directory.

16 lines (15 loc) 493 B
import type { FastifyReply, FastifyRequest, FastifySchema } from 'fastify'; export interface RouteHandler { (request: FastifyRequest, reply: FastifyReply): Promise<void>; } export type RouteSchema = FastifySchema; export type TypedRouteSchema<Query = object, Body = object, Params = object, Headers = object> = { querystring?: Query; body?: Body; params?: Params; response?: Headers; }; export interface RouteModule { default: RouteHandler; schema?: RouteSchema; }