Controller

DEV/Node.js

[Nest.js] Official Document 정리 (Controller) - 2

Status Code 언급한대로 기본적으로 상태 코드는 POST 요청을 제외하고는 항상 200이다. @HttpCode() decorator 를 통해 핸들러 레벨에서 쉽게 바꿀 수 있다. @Put() @HttpCode(204) modifyCat(): string { return 'modify cat'; } HttpCode 는 @nestjs/common 패키지에서 import 한다. 종종 상태 코드가 정적이 아니라 다양한 요인에 의해 달라질 수 있다. 이 경우 library-specific response 객체를 사용할 수 있다. (@Res()) Headers custom response header 를 위해 @Header() decorator 나 library-specific response 객체를 사용 ..

jobchae
'Controller' 태그의 글 목록