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

Not work if any controller in module has @Get('*')

Mati365 opened this issue · comments

ServeStaticModule not work if any controller in module has @get('*')

I'm submitting a...


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

Current behavior

Returns html content from @get('*') controller

Expected behavior

Should return asset

Minimal reproduction of the problem with instructions

@Module(
  {
    imports: [
      ServeStaticModule.forRoot(
        {
          serveRoot: '/public',
          renderPath: '/public',
          rootPath: path.resolve(__dirname, 'public/'),
          serveStaticOptions: {
            index: false,
          },
        },
      ),
    ],
    controllers: [
      FrontController,
    ],
    providers: [],
  },
)
class FrontModule {}

@Controller()
export class FrontController {
  @Get('*')
  @Accepts('html')
  index(@Res() res: Response) {
    res.send('dupa2');
  }
}

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

Environment

    "@nestjs/common": "^7.5.5",
    "@nestjs/core": "^7.5.5",
    "@nestjs/platform-express": "^7.5.5",
    "@nestjs/serve-static": "^2.1.4",

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

@kamilmysliwiec why did you close it? its bug report, not support question

@kamilmysliwiec why did you close it? its bug report, not support question

did you solved it ?