问题
I am currently serving static files for some developer static docs I have created, I am currently using
app.useStaticAssets(docsLocation, {
prefix: "/docs/"
})
My question is that I have another directory that I would like to serve, it also has static content, is it possible to serve from different locations and using a different prefix for each location?
Any ideas, this is not covered in the documentation.
Thanks
回答1:
You can just register static assets multiple times:
app.useStaticAssets(docsLocation1, { prefix: "/docs1/" })
app.useStaticAssets(docsLocation2, { prefix: "/docs2/" })
来源:https://stackoverflow.com/questions/55989258/serving-multiple-static-files-in-nestjs-for-different-locations-and-prefixes