Comments (6)
How to use it? The following code doesn't seem to work.
@Module({ imports: [ ServeStaticModule.forRoot({ rootPath: path.join(process.mainModule['path'], 'client'), }), ServeStaticModule.forRoot({ rootPath: path.join(process.mainModule['path'], 'data'), serveRoot: 'data', renderPath: 'data', }), ], }) export class AppModule { }
Fixed:
@Module({
imports: [
ServeStaticModule.forRoot({
rootPath: path.join(process.mainModule['path'], 'client'),
}),
ServeStaticModule.forRoot({
rootPath: path.join(process.mainModule['path'], 'data'),
serveRoot: '/data',
}),
],
})
export class AppModule {
}
from serve-static.
This does not work with platform fastify. What if another property, 'decorateReply' is allowed to pass just for fastify, same as exclude is passed for express? Currently i have to override the interface then send this property as false to make it work.
from serve-static.
Would you like to create PR for this issue?
from serve-static.
Added in 2.0.0
from serve-static.
How to use it? The following code doesn't seem to work.
@Module({
imports: [
ServeStaticModule.forRoot({
rootPath: path.join(process.mainModule['path'], 'client'),
}),
ServeStaticModule.forRoot({
rootPath: path.join(process.mainModule['path'], 'data'),
serveRoot: 'data',
renderPath: 'data',
}),
],
})
export class AppModule {
}
from serve-static.
@amit78523 I've tried doing your decorateReply workaround for platform-fastify which worked to get rid of the The decorator 'sendFile' has already been added
error but only the default path is being served. Did you need to do anything else to get multiple roots working with platform-fastify?
from serve-static.
Related Issues (20)
- serveRoot doesn't work with fastify platform HOT 3
- Get dynamic path
- After updating static-asset to 3.x, excluded paths fallback to index.html ( instead of returning a 404 ) HOT 2
- path-style versioning of static asset HOT 1
- Serve static can't handle globalprefix HOT 1
- Nest can't resolve dependencies of the ServeStaticModule HOT 7
- Provide a documentation how to use setHeaders function
- Support `preCompressed` from `@fastify/static` HOT 1
- Cannot upgrade NestJS dependencies due to @fastify/static package HOT 1
- Not work if any controller in module has @Get('*') HOT 3
- Missing 'prefix' property in ServeStaticOptions HOT 1
- Action Required: Fix Renovate Configuration
- Error when set renderPath as regexp HOT 1
- serveStaticOptions: { index: false } doesn't work HOT 1
- Dependency Dashboard
- WatΡh changes in static folder and reload webpage on change (like browsersync) HOT 1
- Module '"@nestjs/serve-static"' has no exported member 'ServeStaticModule'. HOT 1
- fastify-static is deprecated use @fastify/static instead HOT 1
- Support for nestjs v9 HOT 1
- Transform/Manipulate index html before sending it HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serve-static.