Skip to content

Commit

Permalink
TS support api.register/routes, req.namespace #137
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Stawecki committed Mar 11, 2020
1 parent 11c6ddd commit 1636a89
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ export declare interface FileOptions {
private?: boolean;
}

export declare interface RegisterOptions {
prefix?: string;
}

export declare interface App {
[namespace: string]: HandlerFunction;
[namespace: string]: any;
}

export declare type Middleware = (req: Request, res: Response, next: () => void) => void;
Expand Down Expand Up @@ -138,6 +142,7 @@ export declare class Request {
userAgent: string;
clientType: 'desktop' | 'mobile' | 'tv' | 'tablet' | 'unknown';
clientCountry: string;
namespace: App;

log: {
trace: LoggerFunction;
Expand Down Expand Up @@ -202,7 +207,10 @@ export declare class API {
any(...handler: HandlerFunction[]): void;
METHOD(method: METHODS, path: string, ...handler: HandlerFunction[]): void;
METHOD(method: METHODS, ...handler: HandlerFunction[]): void;

register(routes: (api: API, options?: RegisterOptions) => void, options?: RegisterOptions): void;
routes(format: true): void;
routes(format: false): string[][];
routes(): string[][];



Expand Down

0 comments on commit 1636a89

Please sign in to comment.