package main import ( "encoding/json" "log" "net/http" "os" "time" ) func main() { mux := http.NewServeMux() mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") _ = json.NewEncoder(w).Encode(map[string]string{"status": "ok", "service": "api"}) }) // Placeholder only: registration/authentication is not implemented. mux.HandleFunc("POST /api/v1/auth/register", func(w http.ResponseWriter, r *http.Request) { http.Error(w, "registration not implemented", http.StatusNotImplemented) }) addr := os.Getenv("API_ADDR") if addr == "" { addr = ":8080" } srv := &http.Server{Addr: addr, Handler: mux, ReadHeaderTimeout: 5 * time.Second} log.Printf("API listening on %s", addr) log.Fatal(srv.ListenAndServe()) }