我正在尝试使用参数过滤路由,但没有成功。我有 2 条路线:
/all
/:id
我正在使用typescript-rest进行动态加载,因此无法先添加所有路由。
Server.loadServices(this.appWebApi, 'app/resources/*.js', `${__dirname}`);
我有这两种方法:
@GET
@Path("all")
async all(@Context context: ServiceContext) {}
@GET
@Path(":id")
async findById(@Context context: ServiceContext, @PathParam("id") id: string) {}
但是当我使用/all
. 我尝试使用^(?!all):id
,但参数不起作用。
那么,如何过滤这两条路线呢?