28 lines
684 B
Go

package api
import (
"encoding/json"
"net/http"
)
// NewHandler returns the API HTTP handler (routes under /).
func NewHandler() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("GET /health", health)
mux.HandleFunc("GET /", root)
return mux
}
func health(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
}
func root(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
_ = json.NewEncoder(w).Encode(map[string]string{
"service": "printer-backend-api",
"message": "API placeholder — endpoints folgen",
})
}