Spring/Spring Framework
-
API ControllerSpring/Spring Framework 2021. 9. 8. 13:20
1️⃣ GET Method 기본 사용법 Path Variable 사용 Query Parameter 사용 Map형태로 입력 변수 각각 매칭하기 DTO에 매칭하기 (추천 방법) 2️⃣ POST Method 기본 사용법 DTO에 매칭 Path Variable 사용법은 Get방식과 동일합니다. 3️⃣ PUT Method 기본 사용법 PathVariable과 DTO 함께 사용 4️⃣ DELETE Method 기본 사용법 5️⃣ Response 만들기 Text로 응답하기 Json으로 응답하기 ResponseEntity로 응답하기 💡 @RestController = 해당 클래스는 REST API를 처리하는 Controller라는 것을 뜻함, 메소드의 리턴값이 View가 아닌 데이터 그 자체를 리턴하게 된다. 1️⃣ ..