package main import ( "database/sql" "encoding/json" "net/http" "github.com/redis/go-redis/v9" ) // Server is a stub for the v1 API. // The full API (registration, job claim/result, ratings) is deferred. // Matchmaking is handled by acb-matchmaker; workers communicate directly with PostgreSQL. type Server struct { cfg Config db *sql.DB rdb *redis.Client } func (s *Server) RegisterRoutes(mux *http.ServeMux) { mux.HandleFunc("GET /health", s.handleHealth) mux.HandleFunc("GET /ready", s.handleReady) } func writeJSON(w http.ResponseWriter, status int, v any) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) json.NewEncoder(w).Encode(v) } func writeError(w http.ResponseWriter, status int, msg string) { writeJSON(w, status, map[string]string{"error": msg}) }