https://github.com/papooch/nestjs-11-fastify-middleware-on-root-path-repro
Reproduction of the related bug report
https://github.com/papooch/nestjs-11-fastify-middleware-on-root-path-repro
Last synced: about 1 year ago
JSON representation
Reproduction of the related bug report
- Host: GitHub
- URL: https://github.com/papooch/nestjs-11-fastify-middleware-on-root-path-repro
- Owner: Papooch
- Created: 2025-01-27T09:03:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-27T09:17:31.000Z (over 1 year ago)
- Last Synced: 2025-01-27T10:23:04.640Z (over 1 year ago)
- Language: TypeScript
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reproduction of an NestJS bug report:
## Fastify middleware doesn't execute on root path with `setGlobalPrefix` when using new wildcard syntax
https://github.com/nestjs/nest/issues/14520
### Background:
This is an empty application generated via `npx @nest/cli new` with the following changes:
* It uses a `FastifyAdapter`
* It uses a global prefix `app.useGlobalPrefix('api')`
* Two middlewares that log the current path are mounted:
* `RootAMiddleware` is mounted using the old syntax `(.*)`
* `RootBMiddleware` is mounted using the new syntax `{*path}`
### Steps to reproduce:
1) `pnpm install`
2) `pnpm start`
3) `curl http://localhost:300/api`
* observe that only _Root A_ middleware was executed:
```
LOG [Root A] triggered on /api
```
3) `curl http://localhost:300/api/xxx`
* observe that both _Root A_ and _Root B_ middlewares were executed:
```
LOG [Root A] triggered on /api/xxx
LOG [Root B] triggered on /api/xxx
```