UNPKG

@tunframework/tun-rest-router

Version:
16 lines (15 loc) 705 B
import { HttpMethod } from '@tunframework/tun'; import { TunComposable, TunContext } from '@tunframework/tun'; export interface Route { methods: Array<keyof typeof HttpMethod>; pathname: string; re: RegExp; slugNames: string[]; slugValues: string[]; slugPositions: number[]; handler: TunComposable<TunContext>; } export declare function parseControllers2Routes(controllers: Record<string, TunComposable<TunContext>>[]): Route[]; export declare function assertLegalPathPartName(name: string): void; export declare function pathToRegexp(pathname: string): Route; export declare function matchRoute(method: string, pathname: string, routes: Route[]): Route | null;