Skip to content

Use multi level paths with one controller but not trigger on static assets #1578

Answered by Romakita
mattiLeBlanc asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @mattiLeBlanc

I just released a new version of Ts.ED that let you to change the statics/controllers order. https://tsed.io/docs/serve-files.html#configuration

It should solve your issue by adding the statics.hook = '$beforeRoutesInit' options.

Also, you can simplify your Get decorator:

@Controller('/')
@UseBefore(ClientGlobalMiddleware)
export class TemplateController {
  constructor(
    private templateService: TemplateService,
  ) { }

  @Get('/:template/:successPage?')
  @View("template.hbs")
  public async get(
    @PathParams('template') template: string,
    @PathParams('successPage') successPage: string,
  ): Promise<any> {
  const content = await this.templateService.getCon…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mattiLeBlanc
Comment options

Answer selected by mattiLeBlanc
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants