-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
We experienced a strange behavior between fastify and express.
In express it is possible that newly added files are served.
With fastify however this is not possible.
This is due to the fastify configuration in the nestjs/static adapter.
wildcard: false, |
As the flag wildcard
is always set to false
, new files are not loaded from the disc anymore.
You can read more about that in the fastify documentation: https://github.com/fastify/fastify-static#wildcard
Default: true
If true, @fastify/static adds a wildcard route to serve files. If false, it globs the filesystem for all defined files in the served folder (${root}//) and creates the necessary routes, but will not serve newly added files.
It would be nice to make this configurable by a setting.
Minimum reproduction code
https://github.com/volkflo/fastify-reproducer
Steps to reproduce
- npm i
- npm run start
- Run
curl http://localhost:3000/ui/index.hmtl
-> works - Run
echo "hello fastify" > client/abc.txt
- Run
curl http://localhost:3000/ui/abc.txt
-> 404 error
Expected behavior
- Newly added files are directly served like in the express-example
- See: https://github.com/nestjs/nest/tree/master/sample/24-serve-static
Package version
5.0.3
NestJS version
11.1.3
Node.js version
20
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
Please let us know if you need more information or have any further questions
Co-Tested with https://github.com/mibeScheer