feat: init api

This commit is contained in:
Ilia Denisov
2026-01-08 13:32:40 +02:00
parent 204d3df8cf
commit 972cfd82be
12 changed files with 240 additions and 108 deletions
+23
View File
@@ -0,0 +1,23 @@
package handler
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/iliadenisov/galaxy/internal/controller"
"github.com/iliadenisov/galaxy/internal/game"
"github.com/iliadenisov/galaxy/internal/model/rest"
)
func StatusHandler(c *gin.Context, config controller.Config) {
g, err := game.LoadState(config)
if transformError(c, err) {
return
}
c.JSON(http.StatusOK, rest.Status{
Turn: g.Age,
Players: len(g.Race),
})
}