1 |
|
2 | import { Middleware, MiddlewareObj } from './middleware';
|
3 | import Context from './context';
|
4 | declare type NonemptyReadonlyArray<T> = readonly [T, ...T[]];
|
5 | declare type RouteFn<TContext extends Context> = (ctx: TContext) => {
|
6 | route: string;
|
7 | context?: Partial<TContext>;
|
8 | state?: Partial<TContext['state']>;
|
9 | } | null;
|
10 | export declare class Router<C extends Context> implements MiddlewareObj<C> {
|
11 | private readonly routeFn;
|
12 | handlers: Map<string, Middleware<C>>;
|
13 | private otherwiseHandler;
|
14 | constructor(routeFn: RouteFn<C>, handlers?: Map<string, Middleware<C>>);
|
15 | on(route: string, ...fns: NonemptyReadonlyArray<Middleware<C>>): this;
|
16 | otherwise(...fns: NonemptyReadonlyArray<Middleware<C>>): this;
|
17 | middleware(): import("./middleware").MiddlewareFn<C>;
|
18 | }
|
19 | export {};
|
20 |
|
\ | No newline at end of file |