-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
56 lines (47 loc) · 2.12 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
declare module "simple-router" {
function mkRouter(): SimpleRouter;
import http = require("http");
import express = require("express");
interface Obj {}
module mkRouter {
export interface Request extends express.Request {
}
export interface Response extends express.Response {
answer(e:Error):void;
answer(data:Buffer):void;
answer(data:String):void;
answer(data:Obj):void;
answer(code:number, data:Buffer):void;
answer(code:number, data:String):void;
answer(code:number, data:Obj):void;
answer(code:number, headers:Obj, data:Buffer):void;
answer(code:number, headers:Obj, data:String):void;
answer(code:number, headers:Obj, data:Obj):void;
}
export interface Handler {
(req:Request, res?:Response, next?:(err?:Error) => void):any
}
export interface Route {}
}
interface SimpleRouter {
get(path:string, ...handler:mkRouter.Handler[]):void;
post(path:string, ...handler:mkRouter.Handler[]):void;
put(path:string, ...handler:mkRouter.Handler[]):void;
head(path:string, ...handler:mkRouter.Handler[]):void;
delete(path:string, ...handler:mkRouter.Handler[]):void;
use(path:string, ...handler:mkRouter.Handler[]):void;
patch(path:string, ...handler:mkRouter.Handler[]):void;
all(path:string, ...handler:mkRouter.Handler[]):void;
propfind(path:string, ...handler:mkRouter.Handler[]):void;
proppatch(path:string, ...handler:mkRouter.Handler[]):void;
mkcol(path:string, ...handler:mkRouter.Handler[]):void;
copy(path:string, ...handler:mkRouter.Handler[]):void;
move(path:string, ...handler:mkRouter.Handler[]):void;
lock(path:string, ...handler:mkRouter.Handler[]):void;
unlock(path:string, ...handler:mkRouter.Handler[]):void;
options(path:string, ...handler:mkRouter.Handler[]):void;
route:mkRouter.Route;
server(): (req:http.IncomingMessage, res:http.ServerResponse) => void;
}
export = mkRouter;
}