GithubHelp home page GithubHelp logo

allow multi-root serving about serve-static HOT 6 CLOSED

dpsthree avatar dpsthree commented on April 19, 2024 5
allow multi-root serving

from serve-static.

Comments (6)

vtulin avatar vtulin commented on April 19, 2024 21

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.

amit78523 avatar amit78523 commented on April 19, 2024 2

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.

kamilmysliwiec avatar kamilmysliwiec commented on April 19, 2024

Would you like to create PR for this issue?

from serve-static.

kamilmysliwiec avatar kamilmysliwiec commented on April 19, 2024

Added in 2.0.0

from serve-static.

vtulin avatar vtulin commented on April 19, 2024

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.

lasharn avatar lasharn commented on April 19, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.