UNPKG

@mahhoura/fastify-autoroutes

Version:
63 lines 2.08 kB
import type { RouteOptions } from 'fastify'; export declare const ERROR_LABEL = "fastify-autoroutes"; export type ValidMethods = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'OPTIONS'; export type AnyRoute = Omit<RouteOptions, 'method' | 'url'>; export type DeleteRoute = AnyRoute; export type GetRoute = Omit<AnyRoute, 'body'>; export type HeadRoute = AnyRoute; export type PatchRoute = AnyRoute; export type PostRoute = AnyRoute; export type PutRoute = AnyRoute; export type OptionsRoute = AnyRoute; interface Security { [key: string]: string[]; } interface StrictAnyRoute extends AnyRoute { schema: { summary?: string; description?: string; security?: Security[]; tags?: string[]; consumes?: string[]; produces?: string[]; body?: any; querystring?: any; params?: any; headers?: any; response?: { [key: number]: any; }; }; } export type StrictDeleteRoute = StrictAnyRoute; export type StrictGetRoute = Omit<StrictAnyRoute, 'body'>; export type StrictHeadRoute = StrictAnyRoute; export type StrictPatchRoute = StrictAnyRoute; export type StrictPostRoute = StrictAnyRoute; export type StrictPutRoute = StrictAnyRoute; export type StrictOptionsRoute = StrictAnyRoute; export interface Resource { delete?: DeleteRoute; get?: GetRoute; head?: HeadRoute; patch?: PatchRoute; post?: PostRoute; put?: PutRoute; options?: OptionsRoute; } export interface StrictResource { delete?: StrictDeleteRoute; get?: StrictGetRoute; head?: StrictHeadRoute; patch?: StrictPatchRoute; post?: StrictPostRoute; put?: StrictPutRoute; options?: StrictOptionsRoute; } interface FastifyAutoroutesOptions { dir?: string; prefix?: string; } declare const _default: import("fastify").FastifyPluginCallback<FastifyAutoroutesOptions, import("fastify").RawServerDefault, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>; export default _default; //# sourceMappingURL=index.d.ts.map