웹/Nest
2024. 1. 16.
Nestjs를 사용할 때 controller에서 400 Validation failed (numeric string is expected) 에러 발생 시
🟩 문제 상황 예시 코드 @Controller('tasks') @UseGuards(AuthGuard()) export class TasksController { constructor(private tasksService: TasksService) { } @Get('/:id') getTaskById(@Param('id', ParseIntPipe) id: number): Promise { return this.tasksService.getTaskById(id); } @Get('/week') getTasksByWeek(@GetUser() user: User): Promise { return this.tasksService.getTasksByWeek(user); } } 이렇게 컨트롤러를 만들었었습니다. 그리고 ..