morz-infoboard/server/backend/internal/httpapi/router.go
Jesko Anschütz 45e7b776ab Erweitere Basis-API um Status-Endpunkte
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-22 18:35:43 +01:00

38 lines
1 KiB
Go

package httpapi
import (
"net/http"
)
func NewRouter(store playerStatusStore) http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, _ *http.Request) {
writeJSON(w, http.StatusOK, map[string]string{
"status": "ok",
"service": "morz-infoboard-backend",
})
})
mux.HandleFunc("GET /api/v1", func(w http.ResponseWriter, _ *http.Request) {
writeJSON(w, http.StatusOK, map[string]any{
"name": "morz-infoboard-backend",
"version": "dev",
"tools": []string{
"message-wall-resolve",
"screen-status-list",
"screen-status-detail",
},
})
})
mux.HandleFunc("GET /api/v1/meta", handleMeta)
mux.HandleFunc("POST /api/v1/player/status", handlePlayerStatus(store))
mux.HandleFunc("GET /api/v1/screens/status", handleListLatestPlayerStatuses(store))
mux.HandleFunc("GET /api/v1/screens/{screenId}/status", handleGetLatestPlayerStatus(store))
mux.HandleFunc("POST /api/v1/tools/message-wall/resolve", handleResolveMessageWall)
return mux
}