UNPKG

fastify-file-router

Version:

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

26 lines 1.14 kB
import type { HTTPMethods } from 'fastify'; /** * Validates and converts a method string to an HTTPMethods type. * @param method - The method string to validate * @param fullPath - The full path to the file (for error messages) * @returns The validated HTTP method * @throws Error if the method is invalid */ export declare function toHttpMethod(method: string, fullPath: string): HTTPMethods; /** * Converts route segments to a Remix-style route path. * @param segments - Array of route segments * @param fullPath - The full path to the file (for error messages) * @returns The converted route path * @throws Error if any segment is invalid */ export declare function toRouteRemixStyle(segments: string[], fullPath: string): string; /** * Converts route segments to a Next.js-style route path. * @param segments - Array of route segments * @param fullPath - The full path to the file (for error messages) * @returns The converted route path * @throws Error if any segment is invalid */ export declare function toRouteNextStyle(segments: string[], fullPath: string): string; //# sourceMappingURL=routeConverter.d.ts.map