@PostMapping("/signup")
public ResponseEntity<CommonResponseDto> signup(@Valid @RequestBody UserRequestDto userRequestDto){
userService.signup(userRequestDto);
return ResponseEntity.status(201).body(new CommonResponseDto("회원가입 성공",201));
}
ResponseEntity 구조
- HttpStatus
- HttpHeader : 요청 요구사항
- HttpBody : 내용
상태코드만 반환해줄 때
return ResponseEntity.ok().build();
'Spring' 카테고리의 다른 글
[TIL] 231219 Timestamped null값 에러 (0) | 2023.12.19 |
---|---|
[TIL] 231215 Spring ResponseEntityList.forEach (0) | 2023.12.15 |
[TIL] 231213 스프링 입문 | 김영한 인프런 (0) | 2023.12.13 |
[TIL] 231212 Spring CRUD 만들기 복습 (0) | 2023.12.12 |
[TIL] 231211 Spring Security 관리자 페이지 만들기, Spring 댓글 페이지, 프로젝트 회고 (2) | 2023.12.11 |