File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
packages/start-server-core/src Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -375,9 +375,26 @@ async function handleServerRoutes(opts: {
375
375
376
376
if ( method ) {
377
377
const handler = serverTreeResult . foundRoute . options . methods [ method ]
378
-
379
378
if ( handler ) {
380
- middlewares . push ( handlerToMiddleware ( handler ) as TODO )
379
+ if ( typeof handler === 'function' ) {
380
+ middlewares . push ( handlerToMiddleware ( handler ) as TODO )
381
+ } else {
382
+ if (
383
+ ( handler as any ) . _options . middlewares &&
384
+ ( handler as any ) . _options . middlewares . length
385
+ ) {
386
+ middlewares . push (
387
+ ...flattenMiddlewares (
388
+ ( handler as any ) . _options . middlewares ,
389
+ ) . map ( ( d ) => d . options . server ) ,
390
+ )
391
+ }
392
+ if ( ( handler as any ) . _options . handler ) {
393
+ middlewares . push (
394
+ handlerToMiddleware ( ( handler as any ) . _options . handler ) ,
395
+ )
396
+ }
397
+ }
381
398
}
382
399
}
383
400
}
You can’t perform that action at this time.
0 commit comments