【发布时间】:2020-05-31 17:08:27
【问题描述】:
我写了一个非常基本的控制器,比如
@Controller('tasks')
export class TasksController {
constructor(private tasksService: TasksService) {}
@Get(':id')
getById(@Param('id') id: string): TaskDto {
console.log('Get Called>>>', id);
const task = this.tasksService.getById(id);
const dto = TaskMapper.toDto(task);
return dto;
}
@Delete(':id')
remove(@Param('id') id: string): void {
console.log('Delete Called>>>', id);
this.tasksService.remove(id);
}
}
我正在使用以下 URI 通过 Postman(也尝试使用 Powershell)调用每个端点,并使用它们各自的 METHOD GET、DELETE。
http://localhost:3000/tasks/83b213a0-8cbf-46e0-a484-e3df7f216e2f
现在,最奇怪的是 CLI 莫名其妙地卡在了控制器文件的一个版本上。现在即使我删除了整个控制器,cli仍然在映射控制器的不同方法。
我尝试了通过各种 yarn、npm 和直接嵌套命令启动应用程序的不同方法,但似乎没有任何东西可以获取最新的文件更改。
我已经检查了整个代码无数次,但无法查明问题!
【问题讨论】:
标签: nestjs