diesel-core
Version:
Web framework built on Web Standards
25 lines (24 loc) • 856 B
TypeScript
import { handlerFunction, middlewareFunc } from "../types";
import { Handler, HTTPVersion } from 'find-my-way';
export interface Router {
add(method: string, path: string, handler: handlerFunction | Handler<HTTPVersion.V1>): void;
find(method: string, path: string): NormalizedRoute | null;
addMiddleware(path: string, handlers: middlewareFunc[] | any): void;
}
export interface RouteMatchResult {
handler: handlerFunction | Handler<HTTPVersion.V1>;
params: {
[k: string]: string | undefined;
};
}
export interface NormalizedRoute {
handler: handlerFunction | handlerFunction[] | middlewareFunc[];
params?: Record<string, string> | string[];
path?: string | {
[k: string]: string | undefined;
};
method?: string;
}
export declare class RouterFactory {
static create(name?: string): Router;
}