clear-router 2.5.0 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.mts +1 -1
- package/dist/core/index.mjs +1 -1
- package/dist/express/index.cjs +11 -13
- package/dist/express/index.d.cts +11 -13
- package/dist/express/index.d.mts +11 -13
- package/dist/express/index.mjs +11 -13
- package/dist/fastify/index.cjs +1 -1
- package/dist/fastify/index.d.cts +1 -1
- package/dist/fastify/index.d.mts +1 -1
- package/dist/fastify/index.mjs +1 -1
- package/dist/h3/index.cjs +5 -7
- package/dist/h3/index.d.cts +5 -7
- package/dist/h3/index.d.mts +5 -7
- package/dist/h3/index.mjs +5 -7
- package/dist/hono/index.cjs +3 -3
- package/dist/hono/index.d.cts +3 -3
- package/dist/hono/index.d.mts +3 -3
- package/dist/hono/index.mjs +3 -3
- package/dist/index.cjs +10 -12
- package/dist/index.d.cts +10 -12
- package/dist/index.d.mts +10 -12
- package/dist/index.mjs +10 -12
- package/dist/koa/index.cjs +79 -4
- package/dist/koa/index.d.cts +88 -4
- package/dist/koa/index.d.mts +88 -4
- package/dist/koa/index.mjs +79 -4
- package/dist/{router-Dxc8FQOl.mjs → router-BReOXz-F.mjs} +10 -12
- package/dist/{router-Cxi21bzi.cjs → router-CHg0pZUO.cjs} +10 -12
- package/dist/{router-A-9JuZPi.d.cts → router-CS_2XQ7I.d.cts} +10 -12
- package/dist/{router-CVeqd7Ro.d.mts → router-_w2VzMQF.d.mts} +10 -12
- package/package.json +2 -2
package/dist/koa/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ApiResourceMiddleware, f as ControllerAction, m as HttpMethod, n as ClearRequest, p as ControllerHandler, r as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { d as ApiResourceMiddleware, f as ControllerAction, m as HttpMethod, n as ClearRequest, p as ControllerHandler, r as Route, t as CoreRouter } from "../router-CS_2XQ7I.cjs";
|
|
2
2
|
import Koa from "koa";
|
|
3
3
|
import Router$1 from "@koa/router";
|
|
4
4
|
|
|
@@ -31,31 +31,115 @@ declare class Router extends CoreRouter {
|
|
|
31
31
|
private static readBody;
|
|
32
32
|
private static sendReturnValue;
|
|
33
33
|
/**
|
|
34
|
-
* Adds a new route to the router
|
|
34
|
+
* Adds a new route to the router.
|
|
35
|
+
*
|
|
36
|
+
* @param methods
|
|
37
|
+
* @param path
|
|
38
|
+
* @param handler
|
|
39
|
+
* @param middlewares
|
|
35
40
|
*/
|
|
36
41
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
43
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
44
|
+
*
|
|
45
|
+
* @param basePath
|
|
46
|
+
* @param controller
|
|
47
|
+
* @param options
|
|
39
48
|
*/
|
|
40
49
|
static apiResource(basePath: string, controller: any, options?: {
|
|
41
50
|
only?: ControllerAction[];
|
|
42
51
|
except?: ControllerAction[];
|
|
43
52
|
middlewares?: ApiResourceMiddleware<Middleware>;
|
|
44
53
|
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* Define a GET route
|
|
56
|
+
*
|
|
57
|
+
* @param path
|
|
58
|
+
* @param handler
|
|
59
|
+
* @param middlewares
|
|
60
|
+
*/
|
|
45
61
|
static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
62
|
+
/**
|
|
63
|
+
* Define a POST route
|
|
64
|
+
*
|
|
65
|
+
* @param path
|
|
66
|
+
* @param handler
|
|
67
|
+
* @param middlewares
|
|
68
|
+
*/
|
|
46
69
|
static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
70
|
+
/**
|
|
71
|
+
* Define a PUT route
|
|
72
|
+
*
|
|
73
|
+
* @param path
|
|
74
|
+
* @param handler
|
|
75
|
+
* @param middlewares
|
|
76
|
+
*/
|
|
47
77
|
static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
78
|
+
/**
|
|
79
|
+
* Define a DELETE route
|
|
80
|
+
*
|
|
81
|
+
* @param path
|
|
82
|
+
* @param handler
|
|
83
|
+
* @param middlewares
|
|
84
|
+
*/
|
|
48
85
|
static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
|
+
/**
|
|
87
|
+
* Define a PATCH route
|
|
88
|
+
*
|
|
89
|
+
* @param path
|
|
90
|
+
* @param handler
|
|
91
|
+
* @param middlewares
|
|
92
|
+
*/
|
|
49
93
|
static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
|
+
/**
|
|
95
|
+
* Define an OPTIONS route
|
|
96
|
+
*
|
|
97
|
+
* @param path
|
|
98
|
+
* @param handler
|
|
99
|
+
* @param middlewares
|
|
100
|
+
*/
|
|
50
101
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
102
|
+
/**
|
|
103
|
+
* Adds a new HEAD route to the router.
|
|
104
|
+
*
|
|
105
|
+
* @param this
|
|
106
|
+
* @param path
|
|
107
|
+
* @param handler
|
|
108
|
+
* @param middlewares
|
|
109
|
+
*/
|
|
51
110
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
111
|
+
/**
|
|
112
|
+
* Defines a group of routes with a common prefix.
|
|
113
|
+
*
|
|
114
|
+
* @param prefix
|
|
115
|
+
* @param callback
|
|
116
|
+
* @param middlewares
|
|
117
|
+
*/
|
|
52
118
|
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: Middleware[]): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Apply middlewares to a group of routes defined within the callback
|
|
121
|
+
*
|
|
122
|
+
* @param middlewares - Middleware or array of middlewares to apply
|
|
123
|
+
* @param callback - Function that defines the routes to which the middlewares will be applied
|
|
124
|
+
*/
|
|
53
125
|
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get all defined routes, optionally organized by path or method
|
|
128
|
+
*/
|
|
54
129
|
static allRoutes(): Array<Route<HttpContext, Middleware, Handler>>;
|
|
130
|
+
/**
|
|
131
|
+
* @param type - 'path' to get routes organized by path
|
|
132
|
+
*/
|
|
55
133
|
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler>>;
|
|
134
|
+
/**
|
|
135
|
+
* @param type - 'method' to get routes organized by method
|
|
136
|
+
*/
|
|
56
137
|
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler>> };
|
|
57
138
|
/**
|
|
58
|
-
*
|
|
139
|
+
* Apply the defined routes to a @koa/router instance
|
|
140
|
+
*
|
|
141
|
+
* @param router @koa/router instance
|
|
142
|
+
* @returns The @koa/router instance with the applied routes
|
|
59
143
|
*/
|
|
60
144
|
static apply(router: KoaRouterApp): KoaRouterApp;
|
|
61
145
|
}
|
package/dist/koa/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ApiResourceMiddleware, f as ControllerAction, m as HttpMethod, n as ClearRequest, p as ControllerHandler, r as Route, t as CoreRouter } from "../router-
|
|
1
|
+
import { d as ApiResourceMiddleware, f as ControllerAction, m as HttpMethod, n as ClearRequest, p as ControllerHandler, r as Route, t as CoreRouter } from "../router-_w2VzMQF.mjs";
|
|
2
2
|
import Koa from "koa";
|
|
3
3
|
import Router$1 from "@koa/router";
|
|
4
4
|
|
|
@@ -31,31 +31,115 @@ declare class Router extends CoreRouter {
|
|
|
31
31
|
private static readBody;
|
|
32
32
|
private static sendReturnValue;
|
|
33
33
|
/**
|
|
34
|
-
* Adds a new route to the router
|
|
34
|
+
* Adds a new route to the router.
|
|
35
|
+
*
|
|
36
|
+
* @param methods
|
|
37
|
+
* @param path
|
|
38
|
+
* @param handler
|
|
39
|
+
* @param middlewares
|
|
35
40
|
*/
|
|
36
41
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
43
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
44
|
+
*
|
|
45
|
+
* @param basePath
|
|
46
|
+
* @param controller
|
|
47
|
+
* @param options
|
|
39
48
|
*/
|
|
40
49
|
static apiResource(basePath: string, controller: any, options?: {
|
|
41
50
|
only?: ControllerAction[];
|
|
42
51
|
except?: ControllerAction[];
|
|
43
52
|
middlewares?: ApiResourceMiddleware<Middleware>;
|
|
44
53
|
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* Define a GET route
|
|
56
|
+
*
|
|
57
|
+
* @param path
|
|
58
|
+
* @param handler
|
|
59
|
+
* @param middlewares
|
|
60
|
+
*/
|
|
45
61
|
static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
62
|
+
/**
|
|
63
|
+
* Define a POST route
|
|
64
|
+
*
|
|
65
|
+
* @param path
|
|
66
|
+
* @param handler
|
|
67
|
+
* @param middlewares
|
|
68
|
+
*/
|
|
46
69
|
static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
70
|
+
/**
|
|
71
|
+
* Define a PUT route
|
|
72
|
+
*
|
|
73
|
+
* @param path
|
|
74
|
+
* @param handler
|
|
75
|
+
* @param middlewares
|
|
76
|
+
*/
|
|
47
77
|
static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
78
|
+
/**
|
|
79
|
+
* Define a DELETE route
|
|
80
|
+
*
|
|
81
|
+
* @param path
|
|
82
|
+
* @param handler
|
|
83
|
+
* @param middlewares
|
|
84
|
+
*/
|
|
48
85
|
static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
|
+
/**
|
|
87
|
+
* Define a PATCH route
|
|
88
|
+
*
|
|
89
|
+
* @param path
|
|
90
|
+
* @param handler
|
|
91
|
+
* @param middlewares
|
|
92
|
+
*/
|
|
49
93
|
static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
|
+
/**
|
|
95
|
+
* Define an OPTIONS route
|
|
96
|
+
*
|
|
97
|
+
* @param path
|
|
98
|
+
* @param handler
|
|
99
|
+
* @param middlewares
|
|
100
|
+
*/
|
|
50
101
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
102
|
+
/**
|
|
103
|
+
* Adds a new HEAD route to the router.
|
|
104
|
+
*
|
|
105
|
+
* @param this
|
|
106
|
+
* @param path
|
|
107
|
+
* @param handler
|
|
108
|
+
* @param middlewares
|
|
109
|
+
*/
|
|
51
110
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
111
|
+
/**
|
|
112
|
+
* Defines a group of routes with a common prefix.
|
|
113
|
+
*
|
|
114
|
+
* @param prefix
|
|
115
|
+
* @param callback
|
|
116
|
+
* @param middlewares
|
|
117
|
+
*/
|
|
52
118
|
static group(prefix: string, callback: () => void | Promise<void>, middlewares?: Middleware[]): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Apply middlewares to a group of routes defined within the callback
|
|
121
|
+
*
|
|
122
|
+
* @param middlewares - Middleware or array of middlewares to apply
|
|
123
|
+
* @param callback - Function that defines the routes to which the middlewares will be applied
|
|
124
|
+
*/
|
|
53
125
|
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get all defined routes, optionally organized by path or method
|
|
128
|
+
*/
|
|
54
129
|
static allRoutes(): Array<Route<HttpContext, Middleware, Handler>>;
|
|
130
|
+
/**
|
|
131
|
+
* @param type - 'path' to get routes organized by path
|
|
132
|
+
*/
|
|
55
133
|
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler>>;
|
|
134
|
+
/**
|
|
135
|
+
* @param type - 'method' to get routes organized by method
|
|
136
|
+
*/
|
|
56
137
|
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler>> };
|
|
57
138
|
/**
|
|
58
|
-
*
|
|
139
|
+
* Apply the defined routes to a @koa/router instance
|
|
140
|
+
*
|
|
141
|
+
* @param router @koa/router instance
|
|
142
|
+
* @returns The @koa/router instance with the applied routes
|
|
59
143
|
*/
|
|
60
144
|
static apply(router: KoaRouterApp): KoaRouterApp;
|
|
61
145
|
}
|
package/dist/koa/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CoreRouter } from "../router-
|
|
1
|
+
import { t as CoreRouter } from "../router-BReOXz-F.mjs";
|
|
2
2
|
import { n as resolveResponseMeta, t as isFetchResponse } from "../responses-HOePPAl8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/koa/router.ts
|
|
@@ -56,41 +56,113 @@ var Router = class Router extends CoreRouter {
|
|
|
56
56
|
return ctx.body;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Adds a new route to the router
|
|
59
|
+
* Adds a new route to the router.
|
|
60
|
+
*
|
|
61
|
+
* @param methods
|
|
62
|
+
* @param path
|
|
63
|
+
* @param handler
|
|
64
|
+
* @param middlewares
|
|
60
65
|
*/
|
|
61
66
|
static add(methods, path, handler, middlewares) {
|
|
62
67
|
super.add(methods, path, handler, middlewares);
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
65
|
-
*
|
|
70
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
71
|
+
*
|
|
72
|
+
* @param basePath
|
|
73
|
+
* @param controller
|
|
74
|
+
* @param options
|
|
66
75
|
*/
|
|
67
76
|
static apiResource(basePath, controller, options) {
|
|
68
77
|
super.apiResource(basePath, controller, options);
|
|
69
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Define a GET route
|
|
81
|
+
*
|
|
82
|
+
* @param path
|
|
83
|
+
* @param handler
|
|
84
|
+
* @param middlewares
|
|
85
|
+
*/
|
|
70
86
|
static get(path, handler, middlewares) {
|
|
71
87
|
super.get(path, handler, middlewares);
|
|
72
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Define a POST route
|
|
91
|
+
*
|
|
92
|
+
* @param path
|
|
93
|
+
* @param handler
|
|
94
|
+
* @param middlewares
|
|
95
|
+
*/
|
|
73
96
|
static post(path, handler, middlewares) {
|
|
74
97
|
super.post(path, handler, middlewares);
|
|
75
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Define a PUT route
|
|
101
|
+
*
|
|
102
|
+
* @param path
|
|
103
|
+
* @param handler
|
|
104
|
+
* @param middlewares
|
|
105
|
+
*/
|
|
76
106
|
static put(path, handler, middlewares) {
|
|
77
107
|
super.put(path, handler, middlewares);
|
|
78
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Define a DELETE route
|
|
111
|
+
*
|
|
112
|
+
* @param path
|
|
113
|
+
* @param handler
|
|
114
|
+
* @param middlewares
|
|
115
|
+
*/
|
|
79
116
|
static delete(path, handler, middlewares) {
|
|
80
117
|
super.delete(path, handler, middlewares);
|
|
81
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Define a PATCH route
|
|
121
|
+
*
|
|
122
|
+
* @param path
|
|
123
|
+
* @param handler
|
|
124
|
+
* @param middlewares
|
|
125
|
+
*/
|
|
82
126
|
static patch(path, handler, middlewares) {
|
|
83
127
|
super.patch(path, handler, middlewares);
|
|
84
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Define an OPTIONS route
|
|
131
|
+
*
|
|
132
|
+
* @param path
|
|
133
|
+
* @param handler
|
|
134
|
+
* @param middlewares
|
|
135
|
+
*/
|
|
85
136
|
static options(path, handler, middlewares) {
|
|
86
137
|
super.options(path, handler, middlewares);
|
|
87
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Adds a new HEAD route to the router.
|
|
141
|
+
*
|
|
142
|
+
* @param this
|
|
143
|
+
* @param path
|
|
144
|
+
* @param handler
|
|
145
|
+
* @param middlewares
|
|
146
|
+
*/
|
|
88
147
|
static head(path, handler, middlewares) {
|
|
89
148
|
super.head(path, handler, middlewares);
|
|
90
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Defines a group of routes with a common prefix.
|
|
152
|
+
*
|
|
153
|
+
* @param prefix
|
|
154
|
+
* @param callback
|
|
155
|
+
* @param middlewares
|
|
156
|
+
*/
|
|
91
157
|
static async group(prefix, callback, middlewares) {
|
|
92
158
|
await super.group(prefix, callback, middlewares);
|
|
93
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Apply middlewares to a group of routes defined within the callback
|
|
162
|
+
*
|
|
163
|
+
* @param middlewares - Middleware or array of middlewares to apply
|
|
164
|
+
* @param callback - Function that defines the routes to which the middlewares will be applied
|
|
165
|
+
*/
|
|
94
166
|
static middleware(middlewares, callback) {
|
|
95
167
|
super.middleware(middlewares, callback);
|
|
96
168
|
}
|
|
@@ -98,7 +170,10 @@ var Router = class Router extends CoreRouter {
|
|
|
98
170
|
return super.allRoutes(type);
|
|
99
171
|
}
|
|
100
172
|
/**
|
|
101
|
-
*
|
|
173
|
+
* Apply the defined routes to a @koa/router instance
|
|
174
|
+
*
|
|
175
|
+
* @param router @koa/router instance
|
|
176
|
+
* @returns The @koa/router instance with the applied routes
|
|
102
177
|
*/
|
|
103
178
|
static apply(router) {
|
|
104
179
|
for (const route of this.routes) {
|
|
@@ -244,7 +244,7 @@ var CoreRouter = class {
|
|
|
244
244
|
return null;
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
|
-
* Adds a new route to the router
|
|
247
|
+
* Adds a new route to the router.
|
|
248
248
|
*
|
|
249
249
|
* @param this
|
|
250
250
|
* @param methods
|
|
@@ -274,8 +274,7 @@ var CoreRouter = class {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
|
-
*
|
|
278
|
-
* options to include/exclude specific actions and apply middlewares.
|
|
277
|
+
* Define a resourceful API controller with standard CRUD routes.
|
|
279
278
|
*
|
|
280
279
|
* @param this
|
|
281
280
|
* @param basePath
|
|
@@ -318,7 +317,7 @@ var CoreRouter = class {
|
|
|
318
317
|
}
|
|
319
318
|
}
|
|
320
319
|
/**
|
|
321
|
-
* Adds a new GET route to the router
|
|
320
|
+
* Adds a new GET route to the router.
|
|
322
321
|
*
|
|
323
322
|
* @param this The router instance.
|
|
324
323
|
* @param path The path for the GET route.
|
|
@@ -329,7 +328,7 @@ var CoreRouter = class {
|
|
|
329
328
|
this.add("get", path, handler, middlewares);
|
|
330
329
|
}
|
|
331
330
|
/**
|
|
332
|
-
* Adds a new POST route to the router
|
|
331
|
+
* Adds a new POST route to the router.
|
|
333
332
|
*
|
|
334
333
|
* @param this
|
|
335
334
|
* @param path
|
|
@@ -340,7 +339,7 @@ var CoreRouter = class {
|
|
|
340
339
|
this.add("post", path, handler, middlewares);
|
|
341
340
|
}
|
|
342
341
|
/**
|
|
343
|
-
* Adds a new PUT route to the router
|
|
342
|
+
* Adds a new PUT route to the router.
|
|
344
343
|
*
|
|
345
344
|
* @param this
|
|
346
345
|
* @param path
|
|
@@ -351,7 +350,7 @@ var CoreRouter = class {
|
|
|
351
350
|
this.add("put", path, handler, middlewares);
|
|
352
351
|
}
|
|
353
352
|
/**
|
|
354
|
-
* Adds a new DELETE route to the router
|
|
353
|
+
* Adds a new DELETE route to the router.
|
|
355
354
|
*
|
|
356
355
|
* @param this
|
|
357
356
|
* @param path
|
|
@@ -362,7 +361,7 @@ var CoreRouter = class {
|
|
|
362
361
|
this.add("delete", path, handler, middlewares);
|
|
363
362
|
}
|
|
364
363
|
/**
|
|
365
|
-
* Adds a new PATCH route to the router
|
|
364
|
+
* Adds a new PATCH route to the router.
|
|
366
365
|
*
|
|
367
366
|
* @param this
|
|
368
367
|
* @param path
|
|
@@ -373,7 +372,7 @@ var CoreRouter = class {
|
|
|
373
372
|
this.add("patch", path, handler, middlewares);
|
|
374
373
|
}
|
|
375
374
|
/**
|
|
376
|
-
* Adds a new OPTIONS route to the router
|
|
375
|
+
* Adds a new OPTIONS route to the router.
|
|
377
376
|
*
|
|
378
377
|
* @param this
|
|
379
378
|
* @param path
|
|
@@ -384,7 +383,7 @@ var CoreRouter = class {
|
|
|
384
383
|
this.add("options", path, handler, middlewares);
|
|
385
384
|
}
|
|
386
385
|
/**
|
|
387
|
-
* Adds a new HEAD route to the router
|
|
386
|
+
* Adds a new HEAD route to the router.
|
|
388
387
|
*
|
|
389
388
|
* @param this
|
|
390
389
|
* @param path
|
|
@@ -395,8 +394,7 @@ var CoreRouter = class {
|
|
|
395
394
|
this.add("head", path, handler, middlewares);
|
|
396
395
|
}
|
|
397
396
|
/**
|
|
398
|
-
* Defines a group of routes with a common prefix
|
|
399
|
-
* organization and reuse of route configurations.
|
|
397
|
+
* Defines a group of routes with a common prefix.
|
|
400
398
|
*
|
|
401
399
|
* @param this
|
|
402
400
|
* @param prefix
|
|
@@ -244,7 +244,7 @@ var CoreRouter = class {
|
|
|
244
244
|
return null;
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
|
-
* Adds a new route to the router
|
|
247
|
+
* Adds a new route to the router.
|
|
248
248
|
*
|
|
249
249
|
* @param this
|
|
250
250
|
* @param methods
|
|
@@ -274,8 +274,7 @@ var CoreRouter = class {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
/**
|
|
277
|
-
*
|
|
278
|
-
* options to include/exclude specific actions and apply middlewares.
|
|
277
|
+
* Define a resourceful API controller with standard CRUD routes.
|
|
279
278
|
*
|
|
280
279
|
* @param this
|
|
281
280
|
* @param basePath
|
|
@@ -318,7 +317,7 @@ var CoreRouter = class {
|
|
|
318
317
|
}
|
|
319
318
|
}
|
|
320
319
|
/**
|
|
321
|
-
* Adds a new GET route to the router
|
|
320
|
+
* Adds a new GET route to the router.
|
|
322
321
|
*
|
|
323
322
|
* @param this The router instance.
|
|
324
323
|
* @param path The path for the GET route.
|
|
@@ -329,7 +328,7 @@ var CoreRouter = class {
|
|
|
329
328
|
this.add("get", path, handler, middlewares);
|
|
330
329
|
}
|
|
331
330
|
/**
|
|
332
|
-
* Adds a new POST route to the router
|
|
331
|
+
* Adds a new POST route to the router.
|
|
333
332
|
*
|
|
334
333
|
* @param this
|
|
335
334
|
* @param path
|
|
@@ -340,7 +339,7 @@ var CoreRouter = class {
|
|
|
340
339
|
this.add("post", path, handler, middlewares);
|
|
341
340
|
}
|
|
342
341
|
/**
|
|
343
|
-
* Adds a new PUT route to the router
|
|
342
|
+
* Adds a new PUT route to the router.
|
|
344
343
|
*
|
|
345
344
|
* @param this
|
|
346
345
|
* @param path
|
|
@@ -351,7 +350,7 @@ var CoreRouter = class {
|
|
|
351
350
|
this.add("put", path, handler, middlewares);
|
|
352
351
|
}
|
|
353
352
|
/**
|
|
354
|
-
* Adds a new DELETE route to the router
|
|
353
|
+
* Adds a new DELETE route to the router.
|
|
355
354
|
*
|
|
356
355
|
* @param this
|
|
357
356
|
* @param path
|
|
@@ -362,7 +361,7 @@ var CoreRouter = class {
|
|
|
362
361
|
this.add("delete", path, handler, middlewares);
|
|
363
362
|
}
|
|
364
363
|
/**
|
|
365
|
-
* Adds a new PATCH route to the router
|
|
364
|
+
* Adds a new PATCH route to the router.
|
|
366
365
|
*
|
|
367
366
|
* @param this
|
|
368
367
|
* @param path
|
|
@@ -373,7 +372,7 @@ var CoreRouter = class {
|
|
|
373
372
|
this.add("patch", path, handler, middlewares);
|
|
374
373
|
}
|
|
375
374
|
/**
|
|
376
|
-
* Adds a new OPTIONS route to the router
|
|
375
|
+
* Adds a new OPTIONS route to the router.
|
|
377
376
|
*
|
|
378
377
|
* @param this
|
|
379
378
|
* @param path
|
|
@@ -384,7 +383,7 @@ var CoreRouter = class {
|
|
|
384
383
|
this.add("options", path, handler, middlewares);
|
|
385
384
|
}
|
|
386
385
|
/**
|
|
387
|
-
* Adds a new HEAD route to the router
|
|
386
|
+
* Adds a new HEAD route to the router.
|
|
388
387
|
*
|
|
389
388
|
* @param this
|
|
390
389
|
* @param path
|
|
@@ -395,8 +394,7 @@ var CoreRouter = class {
|
|
|
395
394
|
this.add("head", path, handler, middlewares);
|
|
396
395
|
}
|
|
397
396
|
/**
|
|
398
|
-
* Defines a group of routes with a common prefix
|
|
399
|
-
* organization and reuse of route configurations.
|
|
397
|
+
* Defines a group of routes with a common prefix.
|
|
400
398
|
*
|
|
401
399
|
* @param this
|
|
402
400
|
* @param prefix
|
|
@@ -211,7 +211,7 @@ declare abstract class CoreRouter {
|
|
|
211
211
|
static configure(this: any, options?: RouterConfig): void;
|
|
212
212
|
protected static resolveMethodOverride(this: any, method: string, headers: Headers | Record<string, any>, body: unknown): HttpMethod | null;
|
|
213
213
|
/**
|
|
214
|
-
* Adds a new route to the router
|
|
214
|
+
* Adds a new route to the router.
|
|
215
215
|
*
|
|
216
216
|
* @param this
|
|
217
217
|
* @param methods
|
|
@@ -221,8 +221,7 @@ declare abstract class CoreRouter {
|
|
|
221
221
|
*/
|
|
222
222
|
static add(this: any, methods: HttpMethod | HttpMethod[], path: string, handler: any, middlewares?: any[] | any): void;
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
225
|
-
* options to include/exclude specific actions and apply middlewares.
|
|
224
|
+
* Define a resourceful API controller with standard CRUD routes.
|
|
226
225
|
*
|
|
227
226
|
* @param this
|
|
228
227
|
* @param basePath
|
|
@@ -235,7 +234,7 @@ declare abstract class CoreRouter {
|
|
|
235
234
|
middlewares?: ApiResourceMiddleware<any>;
|
|
236
235
|
}): void;
|
|
237
236
|
/**
|
|
238
|
-
* Adds a new GET route to the router
|
|
237
|
+
* Adds a new GET route to the router.
|
|
239
238
|
*
|
|
240
239
|
* @param this The router instance.
|
|
241
240
|
* @param path The path for the GET route.
|
|
@@ -244,7 +243,7 @@ declare abstract class CoreRouter {
|
|
|
244
243
|
*/
|
|
245
244
|
static get(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
246
245
|
/**
|
|
247
|
-
* Adds a new POST route to the router
|
|
246
|
+
* Adds a new POST route to the router.
|
|
248
247
|
*
|
|
249
248
|
* @param this
|
|
250
249
|
* @param path
|
|
@@ -253,7 +252,7 @@ declare abstract class CoreRouter {
|
|
|
253
252
|
*/
|
|
254
253
|
static post(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
255
254
|
/**
|
|
256
|
-
* Adds a new PUT route to the router
|
|
255
|
+
* Adds a new PUT route to the router.
|
|
257
256
|
*
|
|
258
257
|
* @param this
|
|
259
258
|
* @param path
|
|
@@ -262,7 +261,7 @@ declare abstract class CoreRouter {
|
|
|
262
261
|
*/
|
|
263
262
|
static put(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
264
263
|
/**
|
|
265
|
-
* Adds a new DELETE route to the router
|
|
264
|
+
* Adds a new DELETE route to the router.
|
|
266
265
|
*
|
|
267
266
|
* @param this
|
|
268
267
|
* @param path
|
|
@@ -271,7 +270,7 @@ declare abstract class CoreRouter {
|
|
|
271
270
|
*/
|
|
272
271
|
static delete(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
273
272
|
/**
|
|
274
|
-
* Adds a new PATCH route to the router
|
|
273
|
+
* Adds a new PATCH route to the router.
|
|
275
274
|
*
|
|
276
275
|
* @param this
|
|
277
276
|
* @param path
|
|
@@ -280,7 +279,7 @@ declare abstract class CoreRouter {
|
|
|
280
279
|
*/
|
|
281
280
|
static patch(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
282
281
|
/**
|
|
283
|
-
* Adds a new OPTIONS route to the router
|
|
282
|
+
* Adds a new OPTIONS route to the router.
|
|
284
283
|
*
|
|
285
284
|
* @param this
|
|
286
285
|
* @param path
|
|
@@ -289,7 +288,7 @@ declare abstract class CoreRouter {
|
|
|
289
288
|
*/
|
|
290
289
|
static options(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
291
290
|
/**
|
|
292
|
-
* Adds a new HEAD route to the router
|
|
291
|
+
* Adds a new HEAD route to the router.
|
|
293
292
|
*
|
|
294
293
|
* @param this
|
|
295
294
|
* @param path
|
|
@@ -298,8 +297,7 @@ declare abstract class CoreRouter {
|
|
|
298
297
|
*/
|
|
299
298
|
static head(this: any, path: string, handler: any, middlewares?: any[] | any): void;
|
|
300
299
|
/**
|
|
301
|
-
* Defines a group of routes with a common prefix
|
|
302
|
-
* organization and reuse of route configurations.
|
|
300
|
+
* Defines a group of routes with a common prefix.
|
|
303
301
|
*
|
|
304
302
|
* @param this
|
|
305
303
|
* @param prefix
|