Skip to content

Instantly share code, notes, and snippets.

@atesibrahim
Created July 16, 2022 10:01
Show Gist options
  • Save atesibrahim/696fec46f519c91e440cbb0e846812bd to your computer and use it in GitHub Desktop.
Save atesibrahim/696fec46f519c91e440cbb0e846812bd to your computer and use it in GitHub Desktop.
@RestController
@RequestMapping("books")
@RequiredArgsConstructor
public class BookController {
private final BookService bookService;
@GetMapping
public List<Book> findAll() {
return bookService.findAll();
}
@PostMapping
public Book save(@RequestBody Book book) {
return bookService.save(book);
}
@DeleteMapping("/{id}")
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