File tree Expand file tree Collapse file tree 2 files changed +15
-18
lines changed
packages/event-handler/src/rest Expand file tree Collapse file tree 2 files changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -205,25 +205,22 @@ class RouteHandlerRegistry {
205
205
routeHandlerRegistry : RouteHandlerRegistry ,
206
206
options ?: { prefix : Path }
207
207
) : void {
208
- for ( const route of routeHandlerRegistry . #staticRoutes. values ( ) ) {
209
- this . register (
210
- new Route (
211
- route . method as HttpMethod ,
212
- options ?. prefix
213
- ? route . path === '/'
214
- ? options . prefix
215
- : `${ options . prefix } ${ route . path } `
216
- : route . path ,
217
- route . handler ,
218
- route . middleware
219
- )
220
- ) ;
221
- }
222
- for ( const route of routeHandlerRegistry . #dynamicRoutes) {
208
+ const routes = [
209
+ ...routeHandlerRegistry . #staticRoutes. values ( ) ,
210
+ ...routeHandlerRegistry . #dynamicRoutes,
211
+ ] ;
212
+ for ( const route of routes ) {
213
+ let path = route . path ;
214
+ if ( options ?. prefix ) {
215
+ path =
216
+ route . path === '/'
217
+ ? options . prefix
218
+ : `${ options . prefix } ${ route . path } ` ;
219
+ }
223
220
this . register (
224
221
new Route (
225
222
route . method as HttpMethod ,
226
- options ?. prefix ? ` ${ options . prefix } ${ route . path } ` : route . path ,
223
+ path ,
227
224
route . handler ,
228
225
route . middleware
229
226
)
Original file line number Diff line number Diff line change @@ -562,11 +562,11 @@ class Router {
562
562
* const todosRouter = new Router();
563
563
*
564
564
* todosRouter.get('/todos', async () => {
565
- * // List Todos
565
+ * // List API
566
566
* });
567
567
*
568
568
* todosRouter.get('/todos/{todoId}', async () => {
569
- * // Get Todo
569
+ * // Get API
570
570
* });
571
571
*
572
572
* const app = new Router();
You can’t perform that action at this time.
0 commit comments