nestjs / serve-static

Serve static websites (SPA's) using Nest framework (node.js) šŸ„¦

Home Page:https://nestjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to disable the default routing on the index.html file

sign0 opened this issue Ā· comments

commented

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I have an API that serves basic endpoints (get/post). I want to add an endpoint which serve a directory which contains files.
NestJS return an error 500 because I don't have an index.html file in the folder ...

Expected behavior

Add an option to disable the default routing on the index.html file and therefore be able to list the contents of a folder.

What is the motivation / use case for changing the behavior?

Build a basic API with get/post endpoints and also serve a directory on a custom path (for example: files uploaded or generated by the API).

Environment


Nest version: 7.0.0
@nestjs/serve-static version: 2.1.3

If you need more flexibility, take a look at app.useStaticAssets() method (or express.static directly https://expressjs.com/en/starter/static-files.html)

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.