@clean-js/api-gen
Version:
[docs](https://lulusir.github.io/clean-js/api-gen/usage) [中文文档](https://github.com/lulusir/clean-js-api-gen/blob/main/README-zh.md)
20 lines (19 loc) • 425 B
TypeScript
type Params = Record<string, string>;
export interface Route {
path: string;
handler: ((params: Params) => any) | null;
}
export declare class Router {
private root;
constructor(routes: Route[]);
private dfs;
log(): void;
add(route: Route): void;
private _insert;
private buildTrie;
match(path: string): {
handler: Route['handler'];
params: Params;
};
}
export {};