-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
74 lines (52 loc) · 1.6 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
import {IncomingMessage, Server, ServerResponse} from "node:http";
declare function expressClone(): expressClone.Application
declare namespace expressClone {
interface Application {
get: IRoute;
post: IRoute;
put: IRoute;
delete: IRoute;
listen: (port: string | number, callback?: () => void) => Server;
use: IUse;
}
interface NextFunction {
(err?: any): void,
(deferToRoute: "route"): void,
(deferToRouter: "router"): void
}
interface IRouteHandler {
(req: Request, res: Response, next: NextFunction): void
}
interface IRoute {
(path: string | RegExp, callback: IRouteHandler): void
}
interface IRouter extends IRouteHandler{
get: IRoute
post: IRoute
put: IRoute
delete: IRoute
use: IUse
}
interface IUse {
(path: string | RegExp, callback: IRouteHandler)
(callback: IRouteHandler)
}
interface Response extends ServerResponse {
send(body?: string | number | boolean | object | Buffer): this;
sendFile(path: string, options?: object): void;
get(field: string): string;
set(field: any): this;
set(field: string, val: string[] | string): this;
type(type: string): this
status(status: number): this
sendStatus(statusCode: number): this
}
interface Request extends IncomingMessage{
params: paramsDictionary
}
interface paramsDictionary{
[key: string]: string
}
export function Router(): IRouter
}
export = expressClone