// PUT Methods
@PutMapping("/book")
public BookDto updateBook(@RequestBody BookDto bookDto){
BookDto book = bookDto;
return book;
}
// Delete Methods
@DeleteMapping("book/{bookName}")
public String deleteBook(@PathVariable String bookName){
// delete SQL ์คํ
return "book : " + bookName + "์ด ์ ๊ฑฐ๋์์ต๋๋ค.";
}
์ฝ๋ ์ถ๊ฐ, ์๋ฒ ์ฌ์คํ
PUT ํด๋ฆญ ํ, BODY ๋ถ๋ถ์ JSON ๋ฐ์ดํฐ author ๋ถ๋ถ ๋ณ๊ฒฝ
{
"name" : "๊น๋นต๋นต์ ๋๊ตฌ์ธ๊ฐ",
"author" : "๊น์์๊ฐ ์๋ ๊น๋นต๋นต"
}
author์ด ๊น์์์์ ๊น์์๊ฐ ์๋ ๊น๋นต๋นต
์ผ๋ก ๋ณ๊ฒฝ๋์๋ค.
PUT ์์ DELETE
๋ก ๋ณ๊ฒฝ
http://localhost:8090/api/v1/book/๊น๋นต๋นต์๋๊ตฌ์ธ๊ฐ
์
๋ ฅ ํ, Send
ํด๋ฆญ
Response Body๋ถ๋ถ์ DELETE๊ฐ ์๋ฃ๋์๋ค๊ณ ์ถ๋ ฅํ๋ค.