Created
July 19, 2022 14:08
-
-
Save atesibrahim/b3d037734f65d2a363fe55e0af7fe4dc to your computer and use it in GitHub Desktop.
Couchbase Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("books") | |
@RequiredArgsConstructor | |
public class BookController { | |
private final BookService bookService; | |
@GetMapping("/{id}") | |
public Book findById(@PathVariable(name = "id") String id) { | |
return bookService.findById(id); | |
} | |
@PostMapping | |
@ResponseStatus(HttpStatus.CREATED) | |
public Book save(@RequestBody Book book) { | |
return bookService.save(book); | |
} | |
@DeleteMapping("/{id}") | |
@ResponseStatus(HttpStatus.NO_CONTENT) | |
public void deleteById(@PathVariable(name = "id") String id) { | |
bookService.deleteById(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment