DeleteApiController @RestController @RequestMapping("/api") class DeleteApiController { // 가질수 있는 것 // 1. path variable // 2. request param @DeleteMapping(path = ["/delete-mapping"]) fun deleteMapping( // 이름 지정 가능 @RequestParam(value = "name") _name: String, @RequestParam(name = "age") _age: Int ): String { println(_name) println(_age) return _name + " " + _age } @DeleteMapping(path = ["/delete-..
PutApiController @RestController @RequestMapping("/api") class PutApiController { @PutMapping("/put-mapping") fun putMapping(): String { return "put-mapping" } @RequestMapping(method = [RequestMethod.PUT], path = ["/request-mapping"]) fun requestMapping(): String { return "request-mapping - put method" } //Post와 동일, Put -> 내용없으면 생성, 있으면 수정 @PutMapping(path = ["/put-mapping/object"]) fun putMappi..
package com.example.mvc.controller.post import com.example.mvc.model.http.UserRequest import org.springframework.web.bind.annotation.* @RestController @RequestMapping("/api") class PostApiController { //현대 방식 @PostMapping("/post-mapping") fun postMapping(): String { return "post-mapping" } //과거 방식 @RequestMapping(method = [RequestMethod.POST], path = ["request-mapping"]) // 주소 외부 노출, url 받는 형식 다..
package com.example.mvc.controller.get import com.example.mvc.model.http.UserRequest import org.springframework.web.bind.annotation.* @RestController //REST API @RequestMapping("/api") //localhost:8080/api class GetApiController { //Get 주소를 노출할때 사용 하는 방법 : 최근 //@GetMapping("/hello") : http://localhost:8080/api/hello @GetMapping(path = ["/hello", "/abcd"]) //Get http://localhost:8080/api/hello, G..
REST 란 ? REST(Representational State Transfer, 자원의 상태 전달) 네트워크 아키텍쳐 원리 RESTful 이란 ? 아래의 몇가지 조건이 잘 지켜진 api가 있을때 RESTful 한 api 라고 할 수 있다. Client, Server : 클라이언트와 서버가 서로 독립적, 분리 Stateless : 요청에 대해서 클라이언트의 상태가 서버에 저장되지 않는다. 요청하는 값을 즉각 요청 ex) 햄버거 가게에서 주문할때, 치즈버거 주문 , 치즈버거 + 콜라 각각 주문, 전에 주문한걸 기억하지 않는다. 캐시 : 클라이언트는 서버의 응답을 캐시 할 수 있다. 클라이언트가 캐시를 통해서 응답을 재사용 할 수 있어야 하며, 이를 통해 서버의 부하를 낮출 수 있다. 계층화(Layered..