/
router.ts
39 lines (31 loc) · 949 Bytes
/
router.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
import {RestkitRouter} from 'restkit/router';
export class KoaRouter extends RestkitRouter {
public bindSelf(parent: RestkitRouter) {
if(parent.mount) {
parent.router.use(this.mount, this.router.routes());
} else {
parent.use(this.router.routes());
}
}
public use(... args: any[]) {
return this.router.use.apply(this.router, args);
}
public static (... args: any[]) {
return this.router.static.apply(this.router, args);
}
public get (... args: any[]) {
return this.router.get.apply(this.router, args);
}
public put (... args: any[]) {
return this.router.put.apply(this.router, args);
}
public post (... args: any[]) {
return this.router.post.apply(this.router, args);
}
public patch (... args: any[]) {
return this.router.patch.apply(this.router, args);
}
public delete (... args: any[]) {
return this.router.delete.apply(this.router, args);
}
}