package docs import ( _ "embed" "net/http" "github.com/go-chi/chi/v5" ) //go:embed openapi.yaml var openAPISpec []byte func NewHandler() *Handler { return &Handler{} } type Handler struct{} func (h *Handler) Routes() chi.Router { r := chi.NewRouter() r.Get("/openapi.yaml", h.serveSpec) r.Get("/", h.serveUI) r.Get("/*", h.serveUI) return r } func (h *Handler) serveSpec(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/yaml; charset=utf-8") w.Header().Set("Cache-Control", "public, max-age=300") _, _ = w.Write(openAPISpec) } func (h *Handler) serveUI(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") _, _ = w.Write([]byte(scalarHTML)) } const scalarHTML = ` Ulti API — Documentation `