Created
April 29, 2024 12:36
-
-
Save Gianni-VE/4cef98d06a88b8733376bf9e942470b7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Laat Spring weten dat in deze class een endpoint gedefinieerd is | |
| @Controller | |
| public class GameController { | |
| // Behandel POST invocaties naar /games | |
| @PostMapping("/games") | |
| ResponseEntity<Void> read(@RequestBody Game game) { | |
| // Antwoord met een 201 status en de URI van de resource | |
| return ResponseEntity.created(URI.create("/games/" + game.id)).build(); | |
| } | |
| private record Game(Long id, String title, String releaseDate, String developer){} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment