clear-router 2.5.0 → 2.5.1
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 +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://github.com/arkstack-hq/clear-router/actions/workflows/npm-publish.yml)
|
|
7
7
|
[](https://github.com/arkstack-hq/clear-router/actions/workflows/ci.yml)
|
|
8
8
|
|
|
9
|
-
Laravel-style routing for Node.js with support for Express, H3, Fastify, and
|
|
9
|
+
Laravel-style routing for Node.js with support for Express, H3, Fastify, Hono, and Koa, including CommonJS, ESM, and TypeScript support.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -49,15 +49,16 @@ yarn add clear-router express
|
|
|
49
49
|
- Function handlers always receive context as first argument
|
|
50
50
|
- Controller handlers receive hydrated `this.body`, `this.query`, `this.params`, and `this.clearRequest`
|
|
51
51
|
- `clearRequest` is passed as second handler argument for controller handlers
|
|
52
|
-
- Route handlers can return response values directly across Express, Fastify, Hono, and
|
|
52
|
+
- Route handlers can return response values directly across Express, Fastify, Hono, H3, and Koa
|
|
53
53
|
- Auto-binds controller methods
|
|
54
54
|
- Full CommonJS, ESM, and TypeScript support
|
|
55
|
-
- Error handling delegated to Express | H3 | Fastify | Hono
|
|
55
|
+
- Error handling delegated to Express | H3 | Fastify | Hono | Koa
|
|
56
56
|
- Route inspection with the `allRoutes` method
|
|
57
57
|
- Fully Express-compatible
|
|
58
58
|
- Fully H3-compatible
|
|
59
59
|
- Fully Fastify-compatible
|
|
60
60
|
- Fully Hono-compatible
|
|
61
|
+
- Fully Koa-compatible
|
|
61
62
|
|
|
62
63
|
## Quick Start
|
|
63
64
|
|
|
@@ -77,6 +78,10 @@ See the [Fastify documentation](https://arkstack-hq.github.io/clear-router/guide
|
|
|
77
78
|
|
|
78
79
|
See the [Hono documentation](https://arkstack-hq.github.io/clear-router/guide/hono) for details.
|
|
79
80
|
|
|
81
|
+
### Koa
|
|
82
|
+
|
|
83
|
+
See the [Koa documentation](https://arkstack-hq.github.io/clear-router/guide/koa) for details.
|
|
84
|
+
|
|
80
85
|
## API Reference
|
|
81
86
|
|
|
82
87
|
See [API.md](https://arkstack-hq.github.io/clear-router/api) for complete API documentation.
|
|
@@ -91,7 +96,7 @@ See [API.md](https://arkstack-hq.github.io/clear-router/api) for complete API do
|
|
|
91
96
|
|
|
92
97
|
- If function: executed directly
|
|
93
98
|
- If [Controller, 'method']: auto-instantiated (if needed), method is called
|
|
94
|
-
- First handler arg is always context (`{ req, res, next }` for Express, H3 event for H3)
|
|
99
|
+
- First handler arg is always context (`{ req, res, next }` for Express, H3 event for H3, Koa context for Koa)
|
|
95
100
|
- Second handler arg is `clearRequest` for controller handlers
|
|
96
101
|
|
|
97
102
|
## Testing
|
|
@@ -122,7 +127,7 @@ See [CHANGELOG.md](CHANGELOG.md) for version history.
|
|
|
122
127
|
## Requirements
|
|
123
128
|
|
|
124
129
|
- Node.js >= 14.0.0
|
|
125
|
-
- Express >= 5.0.0 | H3 >= 2.0.1
|
|
130
|
+
- Express >= 5.0.0 | H3 >= 2.0.1 | Fastify >= 5.0.0 | Hono >= 4.0.0 | Koa >= 3.0.0
|
|
126
131
|
|
|
127
132
|
## License
|
|
128
133
|
|
package/dist/core/index.cjs
CHANGED
package/dist/core/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as CoreRouter } from "../router-
|
|
1
|
+
import { t as CoreRouter } from "../router-CS_2XQ7I.cjs";
|
|
2
2
|
export { CoreRouter };
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as CoreRouter } from "../router-
|
|
1
|
+
import { t as CoreRouter } from "../router-_w2VzMQF.mjs";
|
|
2
2
|
export { CoreRouter };
|
package/dist/core/index.mjs
CHANGED
package/dist/express/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_router = require('../router-
|
|
2
|
+
const require_router = require('../router-CHg0pZUO.cjs');
|
|
3
3
|
const require_responses = require('../responses-r-O3jS-S.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/express/router.ts
|
|
@@ -41,7 +41,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
41
41
|
res.send(meta.body);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Adds a new route to the router
|
|
44
|
+
* Adds a new route to the router.
|
|
45
45
|
*
|
|
46
46
|
* @param methods
|
|
47
47
|
* @param path
|
|
@@ -52,8 +52,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
52
52
|
super.add(methods, path, handler, middlewares);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* optional configuration for included/excluded actions and middlewares.
|
|
55
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
57
56
|
*
|
|
58
57
|
* @param basePath
|
|
59
58
|
* @param controller
|
|
@@ -63,7 +62,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
63
62
|
super.apiResource(basePath, controller, options);
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
|
-
* Adds a new GET route to the router
|
|
65
|
+
* Adds a new GET route to the router.
|
|
67
66
|
*
|
|
68
67
|
* @param path
|
|
69
68
|
* @param handler
|
|
@@ -73,7 +72,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
73
72
|
super.get(path, handler, middlewares);
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
|
-
* Adds a new POST route to the router
|
|
75
|
+
* Adds a new POST route to the router.
|
|
77
76
|
*
|
|
78
77
|
* @param path
|
|
79
78
|
* @param handler
|
|
@@ -83,7 +82,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
83
82
|
super.post(path, handler, middlewares);
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
|
-
* Adds a new PUT route to the router
|
|
85
|
+
* Adds a new PUT route to the router.
|
|
87
86
|
*
|
|
88
87
|
* @param path
|
|
89
88
|
* @param handler
|
|
@@ -93,7 +92,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
93
92
|
super.put(path, handler, middlewares);
|
|
94
93
|
}
|
|
95
94
|
/**
|
|
96
|
-
* Adds a new DELETE route to the router
|
|
95
|
+
* Adds a new DELETE route to the router.
|
|
97
96
|
*
|
|
98
97
|
* @param path
|
|
99
98
|
* @param handler
|
|
@@ -103,7 +102,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
103
102
|
super.delete(path, handler, middlewares);
|
|
104
103
|
}
|
|
105
104
|
/**
|
|
106
|
-
* Adds a new PATCH route to the router
|
|
105
|
+
* Adds a new PATCH route to the router.
|
|
107
106
|
*
|
|
108
107
|
* @param path
|
|
109
108
|
* @param handler
|
|
@@ -113,7 +112,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
113
112
|
super.patch(path, handler, middlewares);
|
|
114
113
|
}
|
|
115
114
|
/**
|
|
116
|
-
* Adds a new OPTIONS route to the router
|
|
115
|
+
* Adds a new OPTIONS route to the router.
|
|
117
116
|
*
|
|
118
117
|
* @param path
|
|
119
118
|
* @param handler
|
|
@@ -123,7 +122,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
123
122
|
super.options(path, handler, middlewares);
|
|
124
123
|
}
|
|
125
124
|
/**
|
|
126
|
-
* Adds a new HEAD route to the router
|
|
125
|
+
* Adds a new HEAD route to the router.
|
|
127
126
|
*
|
|
128
127
|
* @param path
|
|
129
128
|
* @param handler
|
|
@@ -133,8 +132,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
133
132
|
super.head(path, handler, middlewares);
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
|
-
* Defines a group of routes with a common prefix
|
|
137
|
-
* organization and reuse of route configurations.
|
|
135
|
+
* Defines a group of routes with a common prefix.
|
|
138
136
|
*
|
|
139
137
|
* @param prefix
|
|
140
138
|
* @param callback
|
package/dist/express/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Handler, d as ApiResourceMiddleware, f as ControllerAction, l as HttpContext, m as HttpMethod, r as Route, t as CoreRouter, u as Middleware } from "../router-
|
|
1
|
+
import { c as Handler, d as ApiResourceMiddleware, f as ControllerAction, l as HttpContext, m as HttpMethod, r as Route, t as CoreRouter, u as Middleware } from "../router-CS_2XQ7I.cjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
|
@@ -14,7 +14,7 @@ declare class Router extends CoreRouter {
|
|
|
14
14
|
private static ensureRequestBodyAccessor;
|
|
15
15
|
private static sendReturnValue;
|
|
16
16
|
/**
|
|
17
|
-
* Adds a new route to the router
|
|
17
|
+
* Adds a new route to the router.
|
|
18
18
|
*
|
|
19
19
|
* @param methods
|
|
20
20
|
* @param path
|
|
@@ -23,8 +23,7 @@ declare class Router extends CoreRouter {
|
|
|
23
23
|
*/
|
|
24
24
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* optional configuration for included/excluded actions and middlewares.
|
|
26
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
28
27
|
*
|
|
29
28
|
* @param basePath
|
|
30
29
|
* @param controller
|
|
@@ -36,7 +35,7 @@ declare class Router extends CoreRouter {
|
|
|
36
35
|
middlewares?: ApiResourceMiddleware<Middleware>;
|
|
37
36
|
}): void;
|
|
38
37
|
/**
|
|
39
|
-
* Adds a new GET route to the router
|
|
38
|
+
* Adds a new GET route to the router.
|
|
40
39
|
*
|
|
41
40
|
* @param path
|
|
42
41
|
* @param handler
|
|
@@ -44,7 +43,7 @@ declare class Router extends CoreRouter {
|
|
|
44
43
|
*/
|
|
45
44
|
static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
46
45
|
/**
|
|
47
|
-
* Adds a new POST route to the router
|
|
46
|
+
* Adds a new POST route to the router.
|
|
48
47
|
*
|
|
49
48
|
* @param path
|
|
50
49
|
* @param handler
|
|
@@ -52,7 +51,7 @@ declare class Router extends CoreRouter {
|
|
|
52
51
|
*/
|
|
53
52
|
static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
54
53
|
/**
|
|
55
|
-
* Adds a new PUT route to the router
|
|
54
|
+
* Adds a new PUT route to the router.
|
|
56
55
|
*
|
|
57
56
|
* @param path
|
|
58
57
|
* @param handler
|
|
@@ -60,7 +59,7 @@ declare class Router extends CoreRouter {
|
|
|
60
59
|
*/
|
|
61
60
|
static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
62
61
|
/**
|
|
63
|
-
* Adds a new DELETE route to the router
|
|
62
|
+
* Adds a new DELETE route to the router.
|
|
64
63
|
*
|
|
65
64
|
* @param path
|
|
66
65
|
* @param handler
|
|
@@ -68,7 +67,7 @@ declare class Router extends CoreRouter {
|
|
|
68
67
|
*/
|
|
69
68
|
static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
70
69
|
/**
|
|
71
|
-
* Adds a new PATCH route to the router
|
|
70
|
+
* Adds a new PATCH route to the router.
|
|
72
71
|
*
|
|
73
72
|
* @param path
|
|
74
73
|
* @param handler
|
|
@@ -76,7 +75,7 @@ declare class Router extends CoreRouter {
|
|
|
76
75
|
*/
|
|
77
76
|
static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
78
77
|
/**
|
|
79
|
-
* Adds a new OPTIONS route to the router
|
|
78
|
+
* Adds a new OPTIONS route to the router.
|
|
80
79
|
*
|
|
81
80
|
* @param path
|
|
82
81
|
* @param handler
|
|
@@ -84,7 +83,7 @@ declare class Router extends CoreRouter {
|
|
|
84
83
|
*/
|
|
85
84
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
85
|
/**
|
|
87
|
-
* Adds a new HEAD route to the router
|
|
86
|
+
* Adds a new HEAD route to the router.
|
|
88
87
|
*
|
|
89
88
|
* @param path
|
|
90
89
|
* @param handler
|
|
@@ -92,8 +91,7 @@ declare class Router extends CoreRouter {
|
|
|
92
91
|
*/
|
|
93
92
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
93
|
/**
|
|
95
|
-
* Defines a group of routes with a common prefix
|
|
96
|
-
* organization and reuse of route configurations.
|
|
94
|
+
* Defines a group of routes with a common prefix.
|
|
97
95
|
*
|
|
98
96
|
* @param prefix
|
|
99
97
|
* @param callback
|
package/dist/express/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Handler, d as ApiResourceMiddleware, f as ControllerAction, l as HttpContext, m as HttpMethod, r as Route, t as CoreRouter, u as Middleware } from "../router-
|
|
1
|
+
import { c as Handler, d as ApiResourceMiddleware, f as ControllerAction, l as HttpContext, m as HttpMethod, r as Route, t as CoreRouter, u as Middleware } from "../router-_w2VzMQF.mjs";
|
|
2
2
|
import { Router as Router$1 } from "express";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.d.ts
|
|
@@ -14,7 +14,7 @@ declare class Router extends CoreRouter {
|
|
|
14
14
|
private static ensureRequestBodyAccessor;
|
|
15
15
|
private static sendReturnValue;
|
|
16
16
|
/**
|
|
17
|
-
* Adds a new route to the router
|
|
17
|
+
* Adds a new route to the router.
|
|
18
18
|
*
|
|
19
19
|
* @param methods
|
|
20
20
|
* @param path
|
|
@@ -23,8 +23,7 @@ declare class Router extends CoreRouter {
|
|
|
23
23
|
*/
|
|
24
24
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* optional configuration for included/excluded actions and middlewares.
|
|
26
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
28
27
|
*
|
|
29
28
|
* @param basePath
|
|
30
29
|
* @param controller
|
|
@@ -36,7 +35,7 @@ declare class Router extends CoreRouter {
|
|
|
36
35
|
middlewares?: ApiResourceMiddleware<Middleware>;
|
|
37
36
|
}): void;
|
|
38
37
|
/**
|
|
39
|
-
* Adds a new GET route to the router
|
|
38
|
+
* Adds a new GET route to the router.
|
|
40
39
|
*
|
|
41
40
|
* @param path
|
|
42
41
|
* @param handler
|
|
@@ -44,7 +43,7 @@ declare class Router extends CoreRouter {
|
|
|
44
43
|
*/
|
|
45
44
|
static get(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
46
45
|
/**
|
|
47
|
-
* Adds a new POST route to the router
|
|
46
|
+
* Adds a new POST route to the router.
|
|
48
47
|
*
|
|
49
48
|
* @param path
|
|
50
49
|
* @param handler
|
|
@@ -52,7 +51,7 @@ declare class Router extends CoreRouter {
|
|
|
52
51
|
*/
|
|
53
52
|
static post(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
54
53
|
/**
|
|
55
|
-
* Adds a new PUT route to the router
|
|
54
|
+
* Adds a new PUT route to the router.
|
|
56
55
|
*
|
|
57
56
|
* @param path
|
|
58
57
|
* @param handler
|
|
@@ -60,7 +59,7 @@ declare class Router extends CoreRouter {
|
|
|
60
59
|
*/
|
|
61
60
|
static put(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
62
61
|
/**
|
|
63
|
-
* Adds a new DELETE route to the router
|
|
62
|
+
* Adds a new DELETE route to the router.
|
|
64
63
|
*
|
|
65
64
|
* @param path
|
|
66
65
|
* @param handler
|
|
@@ -68,7 +67,7 @@ declare class Router extends CoreRouter {
|
|
|
68
67
|
*/
|
|
69
68
|
static delete(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
70
69
|
/**
|
|
71
|
-
* Adds a new PATCH route to the router
|
|
70
|
+
* Adds a new PATCH route to the router.
|
|
72
71
|
*
|
|
73
72
|
* @param path
|
|
74
73
|
* @param handler
|
|
@@ -76,7 +75,7 @@ declare class Router extends CoreRouter {
|
|
|
76
75
|
*/
|
|
77
76
|
static patch(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
78
77
|
/**
|
|
79
|
-
* Adds a new OPTIONS route to the router
|
|
78
|
+
* Adds a new OPTIONS route to the router.
|
|
80
79
|
*
|
|
81
80
|
* @param path
|
|
82
81
|
* @param handler
|
|
@@ -84,7 +83,7 @@ declare class Router extends CoreRouter {
|
|
|
84
83
|
*/
|
|
85
84
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
85
|
/**
|
|
87
|
-
* Adds a new HEAD route to the router
|
|
86
|
+
* Adds a new HEAD route to the router.
|
|
88
87
|
*
|
|
89
88
|
* @param path
|
|
90
89
|
* @param handler
|
|
@@ -92,8 +91,7 @@ declare class Router extends CoreRouter {
|
|
|
92
91
|
*/
|
|
93
92
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
93
|
/**
|
|
95
|
-
* Defines a group of routes with a common prefix
|
|
96
|
-
* organization and reuse of route configurations.
|
|
94
|
+
* Defines a group of routes with a common prefix.
|
|
97
95
|
*
|
|
98
96
|
* @param prefix
|
|
99
97
|
* @param callback
|
package/dist/express/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, r as responseWasSent, t as isFetchResponse } from "../responses-HOePPAl8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/express/router.ts
|
|
@@ -40,7 +40,7 @@ var Router = class Router extends CoreRouter {
|
|
|
40
40
|
res.send(meta.body);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* Adds a new route to the router
|
|
43
|
+
* Adds a new route to the router.
|
|
44
44
|
*
|
|
45
45
|
* @param methods
|
|
46
46
|
* @param path
|
|
@@ -51,8 +51,7 @@ var Router = class Router extends CoreRouter {
|
|
|
51
51
|
super.add(methods, path, handler, middlewares);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
* optional configuration for included/excluded actions and middlewares.
|
|
54
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
56
55
|
*
|
|
57
56
|
* @param basePath
|
|
58
57
|
* @param controller
|
|
@@ -62,7 +61,7 @@ var Router = class Router extends CoreRouter {
|
|
|
62
61
|
super.apiResource(basePath, controller, options);
|
|
63
62
|
}
|
|
64
63
|
/**
|
|
65
|
-
* Adds a new GET route to the router
|
|
64
|
+
* Adds a new GET route to the router.
|
|
66
65
|
*
|
|
67
66
|
* @param path
|
|
68
67
|
* @param handler
|
|
@@ -72,7 +71,7 @@ var Router = class Router extends CoreRouter {
|
|
|
72
71
|
super.get(path, handler, middlewares);
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
|
-
* Adds a new POST route to the router
|
|
74
|
+
* Adds a new POST route to the router.
|
|
76
75
|
*
|
|
77
76
|
* @param path
|
|
78
77
|
* @param handler
|
|
@@ -82,7 +81,7 @@ var Router = class Router extends CoreRouter {
|
|
|
82
81
|
super.post(path, handler, middlewares);
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* Adds a new PUT route to the router
|
|
84
|
+
* Adds a new PUT route to the router.
|
|
86
85
|
*
|
|
87
86
|
* @param path
|
|
88
87
|
* @param handler
|
|
@@ -92,7 +91,7 @@ var Router = class Router extends CoreRouter {
|
|
|
92
91
|
super.put(path, handler, middlewares);
|
|
93
92
|
}
|
|
94
93
|
/**
|
|
95
|
-
* Adds a new DELETE route to the router
|
|
94
|
+
* Adds a new DELETE route to the router.
|
|
96
95
|
*
|
|
97
96
|
* @param path
|
|
98
97
|
* @param handler
|
|
@@ -102,7 +101,7 @@ var Router = class Router extends CoreRouter {
|
|
|
102
101
|
super.delete(path, handler, middlewares);
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
|
-
* Adds a new PATCH route to the router
|
|
104
|
+
* Adds a new PATCH route to the router.
|
|
106
105
|
*
|
|
107
106
|
* @param path
|
|
108
107
|
* @param handler
|
|
@@ -112,7 +111,7 @@ var Router = class Router extends CoreRouter {
|
|
|
112
111
|
super.patch(path, handler, middlewares);
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
115
|
-
* Adds a new OPTIONS route to the router
|
|
114
|
+
* Adds a new OPTIONS route to the router.
|
|
116
115
|
*
|
|
117
116
|
* @param path
|
|
118
117
|
* @param handler
|
|
@@ -122,7 +121,7 @@ var Router = class Router extends CoreRouter {
|
|
|
122
121
|
super.options(path, handler, middlewares);
|
|
123
122
|
}
|
|
124
123
|
/**
|
|
125
|
-
* Adds a new HEAD route to the router
|
|
124
|
+
* Adds a new HEAD route to the router.
|
|
126
125
|
*
|
|
127
126
|
* @param path
|
|
128
127
|
* @param handler
|
|
@@ -132,8 +131,7 @@ var Router = class Router extends CoreRouter {
|
|
|
132
131
|
super.head(path, handler, middlewares);
|
|
133
132
|
}
|
|
134
133
|
/**
|
|
135
|
-
* Defines a group of routes with a common prefix
|
|
136
|
-
* organization and reuse of route configurations.
|
|
134
|
+
* Defines a group of routes with a common prefix.
|
|
137
135
|
*
|
|
138
136
|
* @param prefix
|
|
139
137
|
* @param callback
|
package/dist/fastify/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_router = require('../router-
|
|
2
|
+
const require_router = require('../router-CHg0pZUO.cjs');
|
|
3
3
|
const require_responses = require('../responses-r-O3jS-S.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/fastify/router.ts
|
package/dist/fastify/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 { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region types/fastify.d.ts
|
package/dist/fastify/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 { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region types/fastify.d.ts
|
package/dist/fastify/index.mjs
CHANGED
package/dist/h3/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_router = require('../router-
|
|
2
|
+
const require_router = require('../router-CHg0pZUO.cjs');
|
|
3
3
|
const require_responses = require('../responses-r-O3jS-S.cjs');
|
|
4
4
|
let h3 = require("h3");
|
|
5
5
|
|
|
@@ -44,7 +44,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
44
44
|
return body;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Adds a new route to the router
|
|
47
|
+
* Adds a new route to the router.
|
|
48
48
|
*
|
|
49
49
|
* @param methods
|
|
50
50
|
* @param path
|
|
@@ -55,8 +55,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
55
55
|
super.add(methods, path, handler, middlewares);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
* to specify included/excluded actions and middlewares.
|
|
58
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
60
59
|
*
|
|
61
60
|
* @param basePath
|
|
62
61
|
* @param controller
|
|
@@ -126,7 +125,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
126
125
|
super.options(path, handler, middlewares);
|
|
127
126
|
}
|
|
128
127
|
/**
|
|
129
|
-
* Adds a new HEAD route to the router
|
|
128
|
+
* Adds a new HEAD route to the router.
|
|
130
129
|
*
|
|
131
130
|
* @param path
|
|
132
131
|
* @param handler
|
|
@@ -136,8 +135,7 @@ var Router = class Router extends require_router.CoreRouter {
|
|
|
136
135
|
super.head(path, handler, middlewares);
|
|
137
136
|
}
|
|
138
137
|
/**
|
|
139
|
-
* Defines a group of routes with a common prefix
|
|
140
|
-
* organization and reuse of route configurations.
|
|
138
|
+
* Defines a group of routes with a common prefix.
|
|
141
139
|
*
|
|
142
140
|
* @param prefix
|
|
143
141
|
* @param callback
|
package/dist/h3/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Handler, d as ApiResourceMiddleware, f as ControllerAction, i as H3App, m as HttpMethod, o as HttpContext, r as Route, s as Middleware, t as CoreRouter } from "../router-
|
|
1
|
+
import { a as Handler, d as ApiResourceMiddleware, f as ControllerAction, i as H3App, m as HttpMethod, o as HttpContext, r as Route, s as Middleware, t as CoreRouter } from "../router-CS_2XQ7I.cjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
|
@@ -14,7 +14,7 @@ declare class Router extends CoreRouter {
|
|
|
14
14
|
private static toResponse;
|
|
15
15
|
private static readBodyCached;
|
|
16
16
|
/**
|
|
17
|
-
* Adds a new route to the router
|
|
17
|
+
* Adds a new route to the router.
|
|
18
18
|
*
|
|
19
19
|
* @param methods
|
|
20
20
|
* @param path
|
|
@@ -23,8 +23,7 @@ declare class Router extends CoreRouter {
|
|
|
23
23
|
*/
|
|
24
24
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* to specify included/excluded actions and middlewares.
|
|
26
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
28
27
|
*
|
|
29
28
|
* @param basePath
|
|
30
29
|
* @param controller
|
|
@@ -84,7 +83,7 @@ declare class Router extends CoreRouter {
|
|
|
84
83
|
*/
|
|
85
84
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
85
|
/**
|
|
87
|
-
* Adds a new HEAD route to the router
|
|
86
|
+
* Adds a new HEAD route to the router.
|
|
88
87
|
*
|
|
89
88
|
* @param path
|
|
90
89
|
* @param handler
|
|
@@ -92,8 +91,7 @@ declare class Router extends CoreRouter {
|
|
|
92
91
|
*/
|
|
93
92
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
93
|
/**
|
|
95
|
-
* Defines a group of routes with a common prefix
|
|
96
|
-
* organization and reuse of route configurations.
|
|
94
|
+
* Defines a group of routes with a common prefix.
|
|
97
95
|
*
|
|
98
96
|
* @param prefix
|
|
99
97
|
* @param callback
|
package/dist/h3/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Handler, d as ApiResourceMiddleware, f as ControllerAction, i as H3App, m as HttpMethod, o as HttpContext, r as Route, s as Middleware, t as CoreRouter } from "../router-
|
|
1
|
+
import { a as Handler, d as ApiResourceMiddleware, f as ControllerAction, i as H3App, m as HttpMethod, o as HttpContext, r as Route, s as Middleware, t as CoreRouter } from "../router-_w2VzMQF.mjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
|
|
4
4
|
//#region src/h3/router.d.ts
|
|
@@ -14,7 +14,7 @@ declare class Router extends CoreRouter {
|
|
|
14
14
|
private static toResponse;
|
|
15
15
|
private static readBodyCached;
|
|
16
16
|
/**
|
|
17
|
-
* Adds a new route to the router
|
|
17
|
+
* Adds a new route to the router.
|
|
18
18
|
*
|
|
19
19
|
* @param methods
|
|
20
20
|
* @param path
|
|
@@ -23,8 +23,7 @@ declare class Router extends CoreRouter {
|
|
|
23
23
|
*/
|
|
24
24
|
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* to specify included/excluded actions and middlewares.
|
|
26
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
28
27
|
*
|
|
29
28
|
* @param basePath
|
|
30
29
|
* @param controller
|
|
@@ -84,7 +83,7 @@ declare class Router extends CoreRouter {
|
|
|
84
83
|
*/
|
|
85
84
|
static options(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
86
85
|
/**
|
|
87
|
-
* Adds a new HEAD route to the router
|
|
86
|
+
* Adds a new HEAD route to the router.
|
|
88
87
|
*
|
|
89
88
|
* @param path
|
|
90
89
|
* @param handler
|
|
@@ -92,8 +91,7 @@ declare class Router extends CoreRouter {
|
|
|
92
91
|
*/
|
|
93
92
|
static head(path: string, handler: Handler, middlewares?: Middleware[] | Middleware): void;
|
|
94
93
|
/**
|
|
95
|
-
* Defines a group of routes with a common prefix
|
|
96
|
-
* organization and reuse of route configurations.
|
|
94
|
+
* Defines a group of routes with a common prefix.
|
|
97
95
|
*
|
|
98
96
|
* @param prefix
|
|
99
97
|
* @param callback
|
package/dist/h3/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 } from "../responses-HOePPAl8.mjs";
|
|
3
3
|
import { getQuery, getRouterParams, readBody } from "h3";
|
|
4
4
|
|
|
@@ -43,7 +43,7 @@ var Router = class Router extends CoreRouter {
|
|
|
43
43
|
return body;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Adds a new route to the router
|
|
46
|
+
* Adds a new route to the router.
|
|
47
47
|
*
|
|
48
48
|
* @param methods
|
|
49
49
|
* @param path
|
|
@@ -54,8 +54,7 @@ var Router = class Router extends CoreRouter {
|
|
|
54
54
|
super.add(methods, path, handler, middlewares);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
* to specify included/excluded actions and middlewares.
|
|
57
|
+
* Define a resourceful API controller with standard CRUD routes
|
|
59
58
|
*
|
|
60
59
|
* @param basePath
|
|
61
60
|
* @param controller
|
|
@@ -125,7 +124,7 @@ var Router = class Router extends CoreRouter {
|
|
|
125
124
|
super.options(path, handler, middlewares);
|
|
126
125
|
}
|
|
127
126
|
/**
|
|
128
|
-
* Adds a new HEAD route to the router
|
|
127
|
+
* Adds a new HEAD route to the router.
|
|
129
128
|
*
|
|
130
129
|
* @param path
|
|
131
130
|
* @param handler
|
|
@@ -135,8 +134,7 @@ var Router = class Router extends CoreRouter {
|
|
|
135
134
|
super.head(path, handler, middlewares);
|
|
136
135
|
}
|
|
137
136
|
/**
|
|
138
|
-
* Defines a group of routes with a common prefix
|
|
139
|
-
* organization and reuse of route configurations.
|
|
137
|
+
* Defines a group of routes with a common prefix.
|
|
140
138
|
*
|
|
141
139
|
* @param prefix
|
|
142
140
|
* @param callback
|