communication with the frontend works

This commit is contained in:
miwr 2025-04-07 14:03:23 +02:00
parent f5a5ba6387
commit a7b76976ac

View file

@ -0,0 +1,28 @@
package de.telekom.silly_game;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping("/game")
public class GameController {
@GetMapping("/start")
public String startGame() {
return "Game started!";
}
private AtomicInteger jumpCount = new AtomicInteger(0);
@GetMapping("/jump")
public Map<String, Integer> registerJump() {
int total = jumpCount.incrementAndGet();
total = total/2;
System.out.println(total);
return Collections.singletonMap("totalJumps", total);
}
}