0

I'm tring to filter a route with param, but no success. I have 2 routes:

/all
/:id

I'm using typescript-rest to dynamic load, so there's no way to add the all route first.

Server.loadServices(this.appWebApi, 'app/resources/*.js', `${__dirname}`);

I have this 2 methods:

@GET
@Path("all")
async all(@Context context: ServiceContext) {}

@GET
@Path(":id")
async findById(@Context context: ServiceContext, @PathParam("id") id: string) {}

But both is called when i use /all. I tried to use ^(?!all):id but the parameter is not working.

So, how to filter this 2 routes?

Lucas Fernando
  • 344
  • 3
  • 11

1 Answers1

1

I found a solution, the problem is related to typescript-rest package.

Here the proposed solution:

https://github.com/thiagobustamante/typescript-rest/issues/78#issuecomment-469232775

Lucas Fernando
  • 344
  • 3
  • 11