import { Body, Controller } from '@nestjs/common';
import { CreateCatDto } from './CreateCatDto';
@Controller('cats')
export class CatsController {
@Get()
findAll(): string {
return 'this action return all cats';
}
@Get(':id')
findOne(@Param('id') id: string): string {
return `This action returns a #${id} cat`;
}
@Post()
create(@Body() createCatDto: CreateCatDto) {
return 'This action adds a new cat';
}
@Put(':id')
update(@Param('id') id: string, @Body() createCatDtp: CreateCatDto) {
return `This action update a #${id} cat`;
}
}
이런 식으로 코드 작성시 Get Post 같은 메소드가 작동을 안함
그래서 확인을 해보니
import { Body, Controller } from '@nestjs/common';
여기에 Get 이나 Post 같은 메서드가 들어가야되는데
확장을 설치한 뒤 메서드를 자동완성 시키면 자동으로 들어가게 되서 오류가 발생하지 않음.