Files
galaxy-game/internal/router/handler/status.go
T
2026-01-30 18:57:43 +03:00

24 lines
448 B
Go

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.Turn,
Players: len(g.Race),
})
}