Package com.fyp.tauceti.controller
Class GameController
java.lang.Object
com.fyp.tauceti.controller.GameController
Spring Controller for interacting with the GAME database table through web APIs
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallGames()
"/games" endpoint: Accepts GET requestsvoid
deleteGame
(Game game) "/games/delete-game" endpoint: Accepts DELETE request and removes a Game object from the database"/games/new" endpoint: Accepts POST request containing a Game object in body and saves it to the database
-
Constructor Details
-
GameController
Parameterised Constructor- Parameters:
repository
- GameRepository object for CRUD operations on GAME database table
-
-
Method Details
-
allGames
"/games" endpoint: Accepts GET requests- Returns:
- A list of all Game records in database
-
newGame
@CrossOrigin(origins="http://localhost:4200") @PostMapping("/games/new") public Game newGame(@RequestBody Game newGame) "/games/new" endpoint: Accepts POST request containing a Game object in body and saves it to the database- Parameters:
newGame
- A Game object retrieved from the HTTP request body- Returns:
- The saved Game object
-
deleteGame
"/games/delete-game" endpoint: Accepts DELETE request and removes a Game object from the database- Parameters:
game
- The Game object to be deleted
-