UNPKG

@iopa/router

Version:

Lightweight and fast router for IOPA applications

36 lines 1.02 kB
import type { IRouter, IRouterResult } from '@iopa/types'; interface IHint { components: string[]; regExpComponents: Array<true | string>; componentsLength: number; endWithWildcard: boolean; paramIndexList: number[]; maybeHandler: boolean; namedParams: [number, string, string][]; } interface IHandlerWithSortIndex<T> { handler: T; index: number; componentsLength: number; } interface IRoute<T> { method: string; path: string; hint: IHint; handlers: IHandlerWithSortIndex<T>[]; middleware: IHandlerWithSortIndex<T>[]; paramAliasMap: Record<string, string[]>; } export declare class RegExpRouter<T> implements IRouter<T> { routeData?: { index: number; routes: IRoute<T>[]; methods: Set<string>; }; add(method: string, path: string, handler: T): void; match(method: string, path: string): IRouterResult<T> | null; private _buildAllMatchers; private _buildMatcher; } export {}; //# sourceMappingURL=router.d.ts.map