728x90
@RestController
@RequestMapping("/mapping/users")
public class MappingClassController {
@GetMapping
public String user(){
return "get users";
}
@PostMapping
public String addUser(){
return "post user";
}
@GetMapping("/{userId}")
public String findUser(@PathVariable String userId) {
return "get userId = " + userId;
}
@PatchMapping("/{userId}")
public String updateUser(@PathVariable String userId) {
return "update userId = " + userId;
}
@DeleteMapping("/{userId}")
public String deleteUser(@PathVariable String userId) {
return "delete userId = " + userId;
}
}
728x90
'백엔드 > Spring(Boot)' 카테고리의 다른 글
스프링 HTTP 요청 파라미터 - @RequestParam (0) | 2021.09.09 |
---|---|
스프링 HTTP 헤더 조회 (0) | 2021.09.09 |
스프링 요청 매핑 (0) | 2021.09.09 |
로깅 (0) | 2021.09.08 |
JPA 페이징 (0) | 2021.09.03 |