Skip to content

Instantly share code, notes, and snippets.

@atesibrahim
Created July 19, 2022 14:08
Show Gist options
  • Save atesibrahim/b3d037734f65d2a363fe55e0af7fe4dc to your computer and use it in GitHub Desktop.
Save atesibrahim/b3d037734f65d2a363fe55e0af7fe4dc to your computer and use it in GitHub Desktop.
Couchbase Example
@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