clear-router 2.8.3 → 2.8.5
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/dist/ClearRequest.d.cts +5 -5
- package/dist/ClearRequest.d.mts +1 -1
- package/dist/Controller.d.mts +1 -1
- package/dist/ResourceRouteSelection.d.cts +3 -3
- package/dist/ResourceRoutes.cjs +1 -1
- package/dist/ResourceRoutes.d.cts +4 -4
- package/dist/ResourceRoutes.d.mts +1 -1
- package/dist/ResourceRoutes.mjs +1 -1
- package/dist/Route.d.cts +4 -4
- package/dist/Route.d.mts +1 -1
- package/dist/RouteGroup.cjs +36 -6
- package/dist/RouteGroup.d.cts +14 -5
- package/dist/RouteGroup.d.mts +12 -3
- package/dist/RouteGroup.mjs +36 -6
- package/dist/core/CoreRouter.cjs +2 -2
- package/dist/core/CoreRouter.d.cts +4 -4
- package/dist/core/CoreRouter.d.mts +1 -1
- package/dist/core/CoreRouter.mjs +2 -2
- package/dist/core/Request.d.cts +1 -1
- package/dist/core/Request.d.mts +2 -2
- package/dist/core/bindings.d.cts +6 -1
- package/dist/core/helpers.d.cts +1 -1
- package/dist/core/helpers.d.mts +1 -1
- package/dist/core/index.cjs +9 -0
- package/dist/core/index.mjs +2 -2
- package/dist/core/plugins.d.cts +2 -2
- package/dist/core/plugins.d.mts +1 -1
- package/dist/decorators/setup.d.mts +1 -0
- package/dist/express/router.d.cts +15 -15
- package/dist/express/router.d.mts +15 -15
- package/dist/fastify/router.d.cts +15 -15
- package/dist/fastify/router.d.mts +15 -15
- package/dist/h3/router.d.cts +15 -15
- package/dist/h3/router.d.mts +15 -15
- package/dist/hono/router.d.cts +15 -15
- package/dist/hono/router.d.mts +15 -15
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/koa/router.d.cts +17 -17
- package/dist/koa/router.d.mts +17 -17
- package/dist/types/basic.cjs +0 -0
- package/dist/types/basic.d.cts +8 -3
- package/dist/types/basic.d.mts +5 -4
- package/dist/types/express.cjs +0 -0
- package/dist/types/express.d.cts +36 -2
- package/dist/types/express.d.mts +3 -3
- package/dist/types/fastify.cjs +0 -0
- package/dist/types/fastify.d.cts +15 -3
- package/dist/types/fastify.d.mts +3 -3
- package/dist/types/h3.cjs +0 -0
- package/dist/types/h3.d.cts +42 -5
- package/dist/types/h3.d.mts +8 -6
- package/dist/types/hono.cjs +0 -0
- package/dist/types/hono.d.cts +18 -3
- package/dist/types/hono.d.mts +4 -3
- package/dist/types/koa.cjs +0 -0
- package/dist/types/koa.d.cts +21 -2
- package/dist/types/koa.d.mts +4 -3
- package/package.json +25 -7
- package/dist/Route-tq-rge1g.d.mts +0 -136
- package/dist/types/index.d.mts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
1
2
|
import { Handler, HttpContext, Middleware } from "../types/express.mjs";
|
|
2
3
|
import { Route } from "../Route.mjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -26,7 +26,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
26
26
|
* @param handler
|
|
27
27
|
* @param middlewares
|
|
28
28
|
*/
|
|
29
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler
|
|
29
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
30
30
|
/**
|
|
31
31
|
* Define a resourceful API controller with standard CRUD routes
|
|
32
32
|
*
|
|
@@ -46,7 +46,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
46
46
|
* @param handler
|
|
47
47
|
* @param middlewares
|
|
48
48
|
*/
|
|
49
|
-
static get(path: string, handler: Handler
|
|
49
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Adds a new POST route to the router.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
54
54
|
* @param handler
|
|
55
55
|
* @param middlewares
|
|
56
56
|
*/
|
|
57
|
-
static post(path: string, handler: Handler
|
|
57
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
58
58
|
/**
|
|
59
59
|
* Adds a new PUT route to the router.
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
62
62
|
* @param handler
|
|
63
63
|
* @param middlewares
|
|
64
64
|
*/
|
|
65
|
-
static put(path: string, handler: Handler
|
|
65
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
66
66
|
/**
|
|
67
67
|
* Adds a new DELETE route to the router.
|
|
68
68
|
*
|
|
@@ -70,7 +70,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
70
70
|
* @param handler
|
|
71
71
|
* @param middlewares
|
|
72
72
|
*/
|
|
73
|
-
static delete(path: string, handler: Handler
|
|
73
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
74
74
|
/**
|
|
75
75
|
* Adds a new PATCH route to the router.
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
78
78
|
* @param handler
|
|
79
79
|
* @param middlewares
|
|
80
80
|
*/
|
|
81
|
-
static patch(path: string, handler: Handler
|
|
81
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
82
82
|
/**
|
|
83
83
|
* Adds a new OPTIONS route to the router.
|
|
84
84
|
*
|
|
@@ -86,7 +86,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
86
86
|
* @param handler
|
|
87
87
|
* @param middlewares
|
|
88
88
|
*/
|
|
89
|
-
static options(path: string, handler: Handler
|
|
89
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
90
90
|
/**
|
|
91
91
|
* Adds a new HEAD route to the router.
|
|
92
92
|
*
|
|
@@ -94,7 +94,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
94
94
|
* @param handler
|
|
95
95
|
* @param middlewares
|
|
96
96
|
*/
|
|
97
|
-
static head(path: string, handler: Handler
|
|
97
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
98
98
|
/**
|
|
99
99
|
* Defines a group of routes with a common prefix.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ declare class Router$1 extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler
|
|
105
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
|
@@ -115,11 +115,11 @@ declare class Router$1 extends CoreRouter {
|
|
|
115
115
|
*
|
|
116
116
|
* @param type
|
|
117
117
|
*/
|
|
118
|
-
static allRoutes(): Array<Route<HttpContext, Middleware, Handler
|
|
119
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler
|
|
120
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler
|
|
121
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler
|
|
122
|
-
static route(name: string): Route<HttpContext, Middleware, Handler
|
|
118
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware, Handler<T>>>;
|
|
119
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
120
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler<T>>> };
|
|
121
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
122
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware, Handler<T>> | undefined;
|
|
123
123
|
/**
|
|
124
124
|
* Applies the registered routes to the given Express router instance, setting up the necessary
|
|
125
125
|
* handlers and middlewares for each route.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
1
2
|
import { FastifyApp, Handler, HttpContext, Middleware } from "../types/fastify.cjs";
|
|
2
3
|
import { Route } from "../Route.cjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -24,7 +24,7 @@ declare class Router extends CoreRouter {
|
|
|
24
24
|
* @param handler Route handler function
|
|
25
25
|
* @param middlewares Optional middlewares for the route
|
|
26
26
|
*/
|
|
27
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler
|
|
27
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
28
28
|
/**
|
|
29
29
|
* Define a resourceful API controller with standard CRUD routes
|
|
30
30
|
*
|
|
@@ -44,7 +44,7 @@ declare class Router extends CoreRouter {
|
|
|
44
44
|
* @param handler
|
|
45
45
|
* @param middlewares
|
|
46
46
|
*/
|
|
47
|
-
static get(path: string, handler: Handler
|
|
47
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
48
48
|
/**
|
|
49
49
|
* Define a POST route
|
|
50
50
|
*
|
|
@@ -52,7 +52,7 @@ declare class Router extends CoreRouter {
|
|
|
52
52
|
* @param handler
|
|
53
53
|
* @param middlewares
|
|
54
54
|
*/
|
|
55
|
-
static post(path: string, handler: Handler
|
|
55
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
56
56
|
/**
|
|
57
57
|
* Define a PUT route
|
|
58
58
|
*
|
|
@@ -60,7 +60,7 @@ declare class Router extends CoreRouter {
|
|
|
60
60
|
* @param handler
|
|
61
61
|
* @param middlewares
|
|
62
62
|
*/
|
|
63
|
-
static put(path: string, handler: Handler
|
|
63
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
64
64
|
/**
|
|
65
65
|
* Define a DELETE route
|
|
66
66
|
*
|
|
@@ -68,7 +68,7 @@ declare class Router extends CoreRouter {
|
|
|
68
68
|
* @param handler
|
|
69
69
|
* @param middlewares
|
|
70
70
|
*/
|
|
71
|
-
static delete(path: string, handler: Handler
|
|
71
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
72
72
|
/**
|
|
73
73
|
* Define a PATCH route
|
|
74
74
|
*
|
|
@@ -76,7 +76,7 @@ declare class Router extends CoreRouter {
|
|
|
76
76
|
* @param handler
|
|
77
77
|
* @param middlewares
|
|
78
78
|
*/
|
|
79
|
-
static patch(path: string, handler: Handler
|
|
79
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
80
80
|
/**
|
|
81
81
|
* Define an OPTIONS route
|
|
82
82
|
*
|
|
@@ -84,7 +84,7 @@ declare class Router extends CoreRouter {
|
|
|
84
84
|
* @param handler
|
|
85
85
|
* @param middlewares
|
|
86
86
|
*/
|
|
87
|
-
static options(path: string, handler: Handler
|
|
87
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
88
88
|
/**
|
|
89
89
|
* Define a HEAD route
|
|
90
90
|
*
|
|
@@ -92,7 +92,7 @@ declare class Router extends CoreRouter {
|
|
|
92
92
|
* @param handler
|
|
93
93
|
* @param middlewares
|
|
94
94
|
*/
|
|
95
|
-
static head(path: string, handler: Handler
|
|
95
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
96
96
|
/**
|
|
97
97
|
* Define a group of routes with a common prefix and optional middlewares
|
|
98
98
|
*
|
|
@@ -100,7 +100,7 @@ declare class Router extends CoreRouter {
|
|
|
100
100
|
* @param callback
|
|
101
101
|
* @param middlewares
|
|
102
102
|
*/
|
|
103
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler
|
|
103
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>>;
|
|
104
104
|
/**
|
|
105
105
|
* Apply middlewares to a group of routes defined within the callback
|
|
106
106
|
*
|
|
@@ -108,17 +108,17 @@ declare class Router extends CoreRouter {
|
|
|
108
108
|
* @param callback
|
|
109
109
|
*/
|
|
110
110
|
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
111
|
-
static allRoutes(): Array<Route<HttpContext, Middleware, Handler
|
|
111
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware, Handler<T>>>;
|
|
112
112
|
/**
|
|
113
113
|
* @param type - 'path' to get routes organized by path
|
|
114
114
|
*/
|
|
115
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler
|
|
115
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
116
116
|
/**
|
|
117
117
|
* @param type - 'method' to get routes organized by method
|
|
118
118
|
*/
|
|
119
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler
|
|
120
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler
|
|
121
|
-
static route(name: string): Route<HttpContext, Middleware, Handler
|
|
119
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler<T>>> };
|
|
120
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
121
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware, Handler<T>> | undefined;
|
|
122
122
|
/**
|
|
123
123
|
* Apply the defined routes to a Fastify application instance
|
|
124
124
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
1
2
|
import { FastifyApp, Handler, HttpContext, Middleware } from "../types/fastify.mjs";
|
|
2
3
|
import { Route } from "../Route.mjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -24,7 +24,7 @@ declare class Router extends CoreRouter {
|
|
|
24
24
|
* @param handler Route handler function
|
|
25
25
|
* @param middlewares Optional middlewares for the route
|
|
26
26
|
*/
|
|
27
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler
|
|
27
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
28
28
|
/**
|
|
29
29
|
* Define a resourceful API controller with standard CRUD routes
|
|
30
30
|
*
|
|
@@ -44,7 +44,7 @@ declare class Router extends CoreRouter {
|
|
|
44
44
|
* @param handler
|
|
45
45
|
* @param middlewares
|
|
46
46
|
*/
|
|
47
|
-
static get(path: string, handler: Handler
|
|
47
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
48
48
|
/**
|
|
49
49
|
* Define a POST route
|
|
50
50
|
*
|
|
@@ -52,7 +52,7 @@ declare class Router extends CoreRouter {
|
|
|
52
52
|
* @param handler
|
|
53
53
|
* @param middlewares
|
|
54
54
|
*/
|
|
55
|
-
static post(path: string, handler: Handler
|
|
55
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
56
56
|
/**
|
|
57
57
|
* Define a PUT route
|
|
58
58
|
*
|
|
@@ -60,7 +60,7 @@ declare class Router extends CoreRouter {
|
|
|
60
60
|
* @param handler
|
|
61
61
|
* @param middlewares
|
|
62
62
|
*/
|
|
63
|
-
static put(path: string, handler: Handler
|
|
63
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
64
64
|
/**
|
|
65
65
|
* Define a DELETE route
|
|
66
66
|
*
|
|
@@ -68,7 +68,7 @@ declare class Router extends CoreRouter {
|
|
|
68
68
|
* @param handler
|
|
69
69
|
* @param middlewares
|
|
70
70
|
*/
|
|
71
|
-
static delete(path: string, handler: Handler
|
|
71
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
72
72
|
/**
|
|
73
73
|
* Define a PATCH route
|
|
74
74
|
*
|
|
@@ -76,7 +76,7 @@ declare class Router extends CoreRouter {
|
|
|
76
76
|
* @param handler
|
|
77
77
|
* @param middlewares
|
|
78
78
|
*/
|
|
79
|
-
static patch(path: string, handler: Handler
|
|
79
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
80
80
|
/**
|
|
81
81
|
* Define an OPTIONS route
|
|
82
82
|
*
|
|
@@ -84,7 +84,7 @@ declare class Router extends CoreRouter {
|
|
|
84
84
|
* @param handler
|
|
85
85
|
* @param middlewares
|
|
86
86
|
*/
|
|
87
|
-
static options(path: string, handler: Handler
|
|
87
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
88
88
|
/**
|
|
89
89
|
* Define a HEAD route
|
|
90
90
|
*
|
|
@@ -92,7 +92,7 @@ declare class Router extends CoreRouter {
|
|
|
92
92
|
* @param handler
|
|
93
93
|
* @param middlewares
|
|
94
94
|
*/
|
|
95
|
-
static head(path: string, handler: Handler
|
|
95
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
96
96
|
/**
|
|
97
97
|
* Define a group of routes with a common prefix and optional middlewares
|
|
98
98
|
*
|
|
@@ -100,7 +100,7 @@ declare class Router extends CoreRouter {
|
|
|
100
100
|
* @param callback
|
|
101
101
|
* @param middlewares
|
|
102
102
|
*/
|
|
103
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler
|
|
103
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>>;
|
|
104
104
|
/**
|
|
105
105
|
* Apply middlewares to a group of routes defined within the callback
|
|
106
106
|
*
|
|
@@ -108,17 +108,17 @@ declare class Router extends CoreRouter {
|
|
|
108
108
|
* @param callback
|
|
109
109
|
*/
|
|
110
110
|
static middleware(middlewares: Middleware[], callback: () => void): void;
|
|
111
|
-
static allRoutes(): Array<Route<HttpContext, Middleware, Handler
|
|
111
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware, Handler<T>>>;
|
|
112
112
|
/**
|
|
113
113
|
* @param type - 'path' to get routes organized by path
|
|
114
114
|
*/
|
|
115
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler
|
|
115
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
116
116
|
/**
|
|
117
117
|
* @param type - 'method' to get routes organized by method
|
|
118
118
|
*/
|
|
119
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler
|
|
120
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler
|
|
121
|
-
static route(name: string): Route<HttpContext, Middleware, Handler
|
|
119
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler<T>>> };
|
|
120
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
121
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware, Handler<T>> | undefined;
|
|
122
122
|
/**
|
|
123
123
|
* Apply the defined routes to a Fastify application instance
|
|
124
124
|
*
|
package/dist/h3/router.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
1
2
|
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "../types/h3.cjs";
|
|
2
3
|
import { Route } from "../Route.cjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -26,7 +26,7 @@ declare class Router extends CoreRouter {
|
|
|
26
26
|
* @param handler
|
|
27
27
|
* @param middlewares
|
|
28
28
|
*/
|
|
29
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler
|
|
29
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
30
30
|
/**
|
|
31
31
|
* Define a resourceful API controller with standard CRUD routes
|
|
32
32
|
*
|
|
@@ -46,7 +46,7 @@ declare class Router extends CoreRouter {
|
|
|
46
46
|
* @param handler
|
|
47
47
|
* @param middlewares
|
|
48
48
|
*/
|
|
49
|
-
static get(path: string, handler: Handler
|
|
49
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Adds a new POST route to the router with the specified path, handler, and optional middlewares.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ declare class Router extends CoreRouter {
|
|
|
54
54
|
* @param handler
|
|
55
55
|
* @param middlewares
|
|
56
56
|
*/
|
|
57
|
-
static post(path: string, handler: Handler
|
|
57
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
58
58
|
/**
|
|
59
59
|
* Adds a new PUT route to the router with the specified path, handler, and optional middlewares.
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@ declare class Router extends CoreRouter {
|
|
|
62
62
|
* @param handler
|
|
63
63
|
* @param middlewares
|
|
64
64
|
*/
|
|
65
|
-
static put(path: string, handler: Handler
|
|
65
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
66
66
|
/**
|
|
67
67
|
* Adds a new DELETE route to the router with the specified path, handler, and optional middlewares.
|
|
68
68
|
*
|
|
@@ -70,7 +70,7 @@ declare class Router extends CoreRouter {
|
|
|
70
70
|
* @param handler
|
|
71
71
|
* @param middlewares
|
|
72
72
|
*/
|
|
73
|
-
static delete(path: string, handler: Handler
|
|
73
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
74
74
|
/**
|
|
75
75
|
* Adds a new PATCH route to the router with the specified path, handler, and optional middlewares.
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ declare class Router extends CoreRouter {
|
|
|
78
78
|
* @param handler
|
|
79
79
|
* @param middlewares
|
|
80
80
|
*/
|
|
81
|
-
static patch(path: string, handler: Handler
|
|
81
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
82
82
|
/**
|
|
83
83
|
* Adds a new OPTIONS route to the router with the specified path, handler, and optional middlewares.
|
|
84
84
|
*
|
|
@@ -86,7 +86,7 @@ declare class Router extends CoreRouter {
|
|
|
86
86
|
* @param handler
|
|
87
87
|
* @param middlewares
|
|
88
88
|
*/
|
|
89
|
-
static options(path: string, handler: Handler
|
|
89
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
90
90
|
/**
|
|
91
91
|
* Adds a new HEAD route to the router.
|
|
92
92
|
*
|
|
@@ -94,7 +94,7 @@ declare class Router extends CoreRouter {
|
|
|
94
94
|
* @param handler
|
|
95
95
|
* @param middlewares
|
|
96
96
|
*/
|
|
97
|
-
static head(path: string, handler: Handler
|
|
97
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
98
98
|
/**
|
|
99
99
|
* Defines a group of routes with a common prefix.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler
|
|
105
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler<T>>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
|
@@ -116,11 +116,11 @@ declare class Router extends CoreRouter {
|
|
|
116
116
|
*
|
|
117
117
|
* @param type
|
|
118
118
|
*/
|
|
119
|
-
static allRoutes(): Array<Route<HttpContext, Middleware$1, Handler
|
|
120
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware$1, Handler
|
|
121
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware$1, Handler
|
|
122
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware$1, Handler
|
|
123
|
-
static route(name: string): Route<HttpContext, Middleware$1, Handler
|
|
119
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
120
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
121
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware$1, Handler<T>>> };
|
|
122
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
123
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware$1, Handler<T>> | undefined;
|
|
124
124
|
/**
|
|
125
125
|
* Applies the registered routes to the given H3 application instance, setting up the
|
|
126
126
|
* necessary handlers and middlewares for each route.
|
package/dist/h3/router.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
1
2
|
import { H3App, Handler, HttpContext, Middleware as Middleware$1 } from "../types/h3.mjs";
|
|
2
3
|
import { Route } from "../Route.mjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.mjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.mjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.mjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.mjs";
|
|
@@ -26,7 +26,7 @@ declare class Router extends CoreRouter {
|
|
|
26
26
|
* @param handler
|
|
27
27
|
* @param middlewares
|
|
28
28
|
*/
|
|
29
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler
|
|
29
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
30
30
|
/**
|
|
31
31
|
* Define a resourceful API controller with standard CRUD routes
|
|
32
32
|
*
|
|
@@ -46,7 +46,7 @@ declare class Router extends CoreRouter {
|
|
|
46
46
|
* @param handler
|
|
47
47
|
* @param middlewares
|
|
48
48
|
*/
|
|
49
|
-
static get(path: string, handler: Handler
|
|
49
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Adds a new POST route to the router with the specified path, handler, and optional middlewares.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ declare class Router extends CoreRouter {
|
|
|
54
54
|
* @param handler
|
|
55
55
|
* @param middlewares
|
|
56
56
|
*/
|
|
57
|
-
static post(path: string, handler: Handler
|
|
57
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
58
58
|
/**
|
|
59
59
|
* Adds a new PUT route to the router with the specified path, handler, and optional middlewares.
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@ declare class Router extends CoreRouter {
|
|
|
62
62
|
* @param handler
|
|
63
63
|
* @param middlewares
|
|
64
64
|
*/
|
|
65
|
-
static put(path: string, handler: Handler
|
|
65
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
66
66
|
/**
|
|
67
67
|
* Adds a new DELETE route to the router with the specified path, handler, and optional middlewares.
|
|
68
68
|
*
|
|
@@ -70,7 +70,7 @@ declare class Router extends CoreRouter {
|
|
|
70
70
|
* @param handler
|
|
71
71
|
* @param middlewares
|
|
72
72
|
*/
|
|
73
|
-
static delete(path: string, handler: Handler
|
|
73
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
74
74
|
/**
|
|
75
75
|
* Adds a new PATCH route to the router with the specified path, handler, and optional middlewares.
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ declare class Router extends CoreRouter {
|
|
|
78
78
|
* @param handler
|
|
79
79
|
* @param middlewares
|
|
80
80
|
*/
|
|
81
|
-
static patch(path: string, handler: Handler
|
|
81
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
82
82
|
/**
|
|
83
83
|
* Adds a new OPTIONS route to the router with the specified path, handler, and optional middlewares.
|
|
84
84
|
*
|
|
@@ -86,7 +86,7 @@ declare class Router extends CoreRouter {
|
|
|
86
86
|
* @param handler
|
|
87
87
|
* @param middlewares
|
|
88
88
|
*/
|
|
89
|
-
static options(path: string, handler: Handler
|
|
89
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
90
90
|
/**
|
|
91
91
|
* Adds a new HEAD route to the router.
|
|
92
92
|
*
|
|
@@ -94,7 +94,7 @@ declare class Router extends CoreRouter {
|
|
|
94
94
|
* @param handler
|
|
95
95
|
* @param middlewares
|
|
96
96
|
*/
|
|
97
|
-
static head(path: string, handler: Handler
|
|
97
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware$1[] | Middleware$1): Route<HttpContext, Middleware$1, Handler<T>>;
|
|
98
98
|
/**
|
|
99
99
|
* Defines a group of routes with a common prefix.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler
|
|
105
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware$1[]): RouteGroup<HttpContext, Middleware$1, Handler<T>>;
|
|
106
106
|
/**
|
|
107
107
|
* Adds global middlewares to the router, which will be applied to all routes.
|
|
108
108
|
*
|
|
@@ -116,11 +116,11 @@ declare class Router extends CoreRouter {
|
|
|
116
116
|
*
|
|
117
117
|
* @param type
|
|
118
118
|
*/
|
|
119
|
-
static allRoutes(): Array<Route<HttpContext, Middleware$1, Handler
|
|
120
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware$1, Handler
|
|
121
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware$1, Handler
|
|
122
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware$1, Handler
|
|
123
|
-
static route(name: string): Route<HttpContext, Middleware$1, Handler
|
|
119
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
120
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
121
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware$1, Handler<T>>> };
|
|
122
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware$1, Handler<T>>>;
|
|
123
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware$1, Handler<T>> | undefined;
|
|
124
124
|
/**
|
|
125
125
|
* Applies the registered routes to the given H3 application instance, setting up the
|
|
126
126
|
* necessary handlers and middlewares for each route.
|
package/dist/hono/router.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
1
2
|
import { Handler, HonoApp, HttpContext, Middleware } from "../types/hono.cjs";
|
|
2
3
|
import { Route } from "../Route.cjs";
|
|
3
|
-
import { ApiResourceMiddleware, HttpMethod, ResourceAction, RouteGroupSource } from "../types/basic.cjs";
|
|
4
4
|
import { ResourceRoutes } from "../ResourceRoutes.cjs";
|
|
5
5
|
import { RouteGroup } from "../RouteGroup.cjs";
|
|
6
6
|
import { CoreRouter } from "../core/CoreRouter.cjs";
|
|
@@ -26,7 +26,7 @@ declare class Router extends CoreRouter {
|
|
|
26
26
|
* @param handler
|
|
27
27
|
* @param middlewares
|
|
28
28
|
*/
|
|
29
|
-
static add(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler
|
|
29
|
+
static add<T = any>(methods: HttpMethod | HttpMethod[], path: string, handler: Handler, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
30
30
|
/**
|
|
31
31
|
* Define a resourceful API controller with standard CRUD routes
|
|
32
32
|
*
|
|
@@ -46,7 +46,7 @@ declare class Router extends CoreRouter {
|
|
|
46
46
|
* @param handler
|
|
47
47
|
* @param middlewares
|
|
48
48
|
*/
|
|
49
|
-
static get(path: string, handler: Handler
|
|
49
|
+
static get<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Define a POST route
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ declare class Router extends CoreRouter {
|
|
|
54
54
|
* @param handler
|
|
55
55
|
* @param middlewares
|
|
56
56
|
*/
|
|
57
|
-
static post(path: string, handler: Handler
|
|
57
|
+
static post<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
58
58
|
/**
|
|
59
59
|
* Define a PUT route
|
|
60
60
|
*
|
|
@@ -62,7 +62,7 @@ declare class Router extends CoreRouter {
|
|
|
62
62
|
* @param handler
|
|
63
63
|
* @param middlewares
|
|
64
64
|
*/
|
|
65
|
-
static put(path: string, handler: Handler
|
|
65
|
+
static put<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
66
66
|
/**
|
|
67
67
|
* Define a DELETE route
|
|
68
68
|
*
|
|
@@ -70,7 +70,7 @@ declare class Router extends CoreRouter {
|
|
|
70
70
|
* @param handler
|
|
71
71
|
* @param middlewares
|
|
72
72
|
*/
|
|
73
|
-
static delete(path: string, handler: Handler
|
|
73
|
+
static delete<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
74
74
|
/**
|
|
75
75
|
* Define a PATCH route
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ declare class Router extends CoreRouter {
|
|
|
78
78
|
* @param handler
|
|
79
79
|
* @param middlewares
|
|
80
80
|
*/
|
|
81
|
-
static patch(path: string, handler: Handler
|
|
81
|
+
static patch<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
82
82
|
/**
|
|
83
83
|
* Define an OPTIONS route
|
|
84
84
|
*
|
|
@@ -86,7 +86,7 @@ declare class Router extends CoreRouter {
|
|
|
86
86
|
* @param handler
|
|
87
87
|
* @param middlewares
|
|
88
88
|
*/
|
|
89
|
-
static options(path: string, handler: Handler
|
|
89
|
+
static options<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
90
90
|
/**
|
|
91
91
|
* Define a HEAD route
|
|
92
92
|
*
|
|
@@ -94,7 +94,7 @@ declare class Router extends CoreRouter {
|
|
|
94
94
|
* @param handler
|
|
95
95
|
* @param middlewares
|
|
96
96
|
*/
|
|
97
|
-
static head(path: string, handler: Handler
|
|
97
|
+
static head<T = any>(path: string, handler: Handler<T>, middlewares?: Middleware[] | Middleware): Route<HttpContext, Middleware, Handler<T>>;
|
|
98
98
|
/**
|
|
99
99
|
* Defines a group of routes with a common prefix.
|
|
100
100
|
*
|
|
@@ -102,7 +102,7 @@ declare class Router extends CoreRouter {
|
|
|
102
102
|
* @param callback
|
|
103
103
|
* @param middlewares
|
|
104
104
|
*/
|
|
105
|
-
static group(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler
|
|
105
|
+
static group<T = any>(prefix: string, source: RouteGroupSource, middlewares?: Middleware[]): RouteGroup<HttpContext, Middleware, Handler<T>>;
|
|
106
106
|
/**
|
|
107
107
|
* Apply middlewares to a group of routes defined within the callback
|
|
108
108
|
*
|
|
@@ -113,17 +113,17 @@ declare class Router extends CoreRouter {
|
|
|
113
113
|
/**
|
|
114
114
|
* Get all defined routes, optionally organized by path or method
|
|
115
115
|
*/
|
|
116
|
-
static allRoutes(): Array<Route<HttpContext, Middleware, Handler
|
|
116
|
+
static allRoutes<T = any>(): Array<Route<HttpContext, Middleware, Handler<T>>>;
|
|
117
117
|
/**
|
|
118
118
|
* @param type - 'path' to get routes organized by path
|
|
119
119
|
*/
|
|
120
|
-
static allRoutes(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler
|
|
120
|
+
static allRoutes<T = any>(type: 'path'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
121
121
|
/**
|
|
122
122
|
* @param type - 'method' to get routes organized by method
|
|
123
123
|
*/
|
|
124
|
-
static allRoutes(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler
|
|
125
|
-
static allRoutes(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler
|
|
126
|
-
static route(name: string): Route<HttpContext, Middleware, Handler
|
|
124
|
+
static allRoutes<T = any>(type: 'method'): { [method in Uppercase<HttpMethod>]?: Array<Route<HttpContext, Middleware, Handler<T>>> };
|
|
125
|
+
static allRoutes<T = any>(type: 'name'): Record<string, Route<HttpContext, Middleware, Handler<T>>>;
|
|
126
|
+
static route<T = any>(name: string): Route<HttpContext, Middleware, Handler<T>> | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* Apply the defined routes to a Hono application instance
|
|
129
129
|
*
|