Added GameController
This commit is contained in:
22
src/main/java/MTGClone/controller/GameController.java
Normal file
22
src/main/java/MTGClone/controller/GameController.java
Normal file
@ -0,0 +1,22 @@
|
||||
package MTGClone.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import MTGClone.SQLDriver;
|
||||
|
||||
@RestController
|
||||
public class GameController {
|
||||
|
||||
private final SQLDriver sqlDriver = new SQLDriver();
|
||||
private final Gson gson = new Gson();
|
||||
private final String apiPrefix = "/api/";
|
||||
|
||||
@GetMapping(apiPrefix + "/allcards")
|
||||
String greet() {
|
||||
return gson.toJson(sqlDriver.getAllCards());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user