- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.1k
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I have an app which uses setGlobalPrefix('api') and then i have a module (non-root) which sets a middleware forRoutes('*').
I would expect the middleware to act on all routes. But it doesn't.
Minimum reproduction code
Steps to reproduce
- npm ci
- npx nx serve example
- curl http://localhost:3000/api
- Observe that there is no "YOU SHOULD SEE ME" in console.
- Edit example/src/main.tsand comment out line17.
- curl http://localhost:3000
- Observe that there is now "YOU SHOULD SEE ME" in console.
Expected behavior
I would expect the middleware to act on all routes. But it doesn't.
Package
- I don't know. Or some 3rd-party package
-  @nestjs/common
-  @nestjs/core
-  @nestjs/microservices
-  @nestjs/platform-express
-  @nestjs/platform-fastify
-  @nestjs/platform-socket.io
-  @nestjs/platform-ws
-  @nestjs/testing
-  @nestjs/websockets
- Other (see below)
Other package
No response
NestJS version
9.4.0
Packages versions
[System Information]
OS Version     : Linux 6.3
NodeJS Version : v20.0.0
NPM Version    : 8.19.4
[Nest CLI]
Nest CLI Version : 9.4.2
[Nest Platform Information]
platform-express version : 9.4.0
schematics version       : 9.1.0
testing version          : 9.4.0
common version           : 9.4.0
core version             : 9.4.0
Node.js version
20.0.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
dinhvanhoang-syncup, binaryartifex, ph55, tjhiggins, alenworld and 5 more