Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
36 lines
974 B
Go
36 lines
974 B
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",
|
|
},
|
|
})
|
|
})
|
|
|
|
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
|
|
}
|