-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
87 lines (80 loc) · 2.73 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
declare interface matchedRoute {
host: string;
method: string;
path: string;
callbacks: any[];
params: object;
subdomains: object;
}
declare interface Route {
host: string;
hostRegexp: RegExp;
method: string;
path: string;
pathRegexp: RegExp;
group: string;
name: string;
params: string[];
subdomains: string[];
callbacks: any[];
caseSensitive: boolean;
setName(name: string): this;
match(options: {
host: string;
method: string;
path: string;
}): boolean | matchedRoute;
}
declare type handler = (req: any, res: any) => void;
export declare class Router {
constructor(options?: { caseSensitive?: boolean; host?: string });
checkout(path: string, ...callbacks: any[]): this;
copy(path: string, ...callbacks: any[]): this;
delete(path: string, ...callbacks: any[]): this;
get(path: string, ...callbacks: any[]): this;
head(path: string, ...callbacks: any[]): this;
lock(path: string, ...callbacks: any[]): this;
merge(path: string, ...callbacks: any[]): this;
mkactivity(path: string, ...callbacks: any[]): this;
mkcol(path: string, ...callbacks: any[]): this;
move(path: string, ...callbacks: any[]): this;
notify(path: string, ...callbacks: any[]): this;
options(path: string, ...callbacks: any[]): this;
patch(path: string, ...callbacks: any[]): this;
post(path: string, ...callbacks: any[]): this;
propfind(path: string, ...callbacks: any[]): this;
purge(path: string, ...callbacks: any[]): this;
put(path: string, ...callbacks: any[]): this;
report(path: string, ...callbacks: any[]): this;
search(path: string, ...callbacks: any[]): this;
subscribe(path: string, ...callbacks: any[]): this;
trace(path: string, ...callbacks: any[]): this;
unlock(path: string, ...callbacks: any[]): this;
unsubscribe(path: string, ...callbacks: any[]): this;
view(path: string, ...callbacks: any[]): this;
any(methods: string | string[], path: string, ...callbacks: any[]): this;
add(method: string, path: string, ...callbacks: any[]): this;
all(path: string, ...callbacks: any[]): this;
use(...callbacks: any): this;
group(path: string, callback: any): this;
domain(host: string, callback: any): this;
setName(name: string): this;
routes(): Route[];
route(name: string, params?: object): string | null;
handle(options: {
requestHost: string;
requestMethod: string;
requestUrl: string;
request: any;
response: any;
}): void;
handler(): handler;
}
export declare function use(...callbacks: any): Route[];
export declare function path(
method: string | string[],
path: string,
...callbacks: any[]
): Route;
export declare function all(path: string, ...callbacks: any[]): Route;
export declare function domain(host: string, routes: any): Route[];