小编Jea*_*ert的帖子

覆盖控制器内的 NestJS 路由

我想完全覆盖控制器路线。例如:

@Controller('shipments')
export class ShipmentsController {

  @Post('/create')
  async find(): Promise<Activities> {
    return service.find()
  }
}
Run Code Online (Sandbox Code Playgroud)

为了向前面的示例发出请求,URL 将为:http://localhost:8080/shipments/create

我想更改该 URL,而不将控制器移动到另一个类。例如,我希望该特定函数的 URL 为 http://localhost:8080/whatever/i/want。

这可能吗?

node.js nestjs

1
推荐指数
1
解决办法
2799
查看次数

标签 统计

nestjs ×1

node.js ×1