31 lines
771 B
Java
31 lines
771 B
Java
package com.bernard.nodecames;
|
|
|
|
import java.util.UUID;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.servlet.view.RedirectView;
|
|
|
|
import com.bernard.nodecames.game.GameManager;
|
|
|
|
@Controller
|
|
public class HttpController {
|
|
|
|
@GetMapping("/")
|
|
public String index() {
|
|
return "index.html";
|
|
}
|
|
|
|
@GetMapping("/room/{id}/grid")
|
|
public String grid(@PathVariable("id") String id) {
|
|
return "grid";
|
|
}
|
|
|
|
@GetMapping("/create-room")
|
|
public RedirectView createRoom() {
|
|
UUID uuid = GameManager.newGrid();
|
|
return new RedirectView("/room/"+uuid.toString()+"/grid");
|
|
}
|
|
}
|