Serve Swagger UI from embedded assets instead of unpkg CDN

Bundle swagger-ui-dist@5.32.5 (bundle + CSS) with go:embed and expose
/docs/swagger-ui-bundle.js and /docs/swagger-ui.css so /docs works without
external script loads (fixes timeouts when unpkg is unreachable).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-05 04:25:44 +00:00
parent 14fcce50af
commit 7a1ceb49c3
4 changed files with 27 additions and 2 deletions

View File

@@ -62,6 +62,8 @@ func NewServer(d Deps) *http.Server {
r.Get("/openapi.json", docs.ServeJSON)
r.Get("/docs", docs.ServeUI)
r.Get("/docs/", docs.ServeUI)
r.Get("/docs/swagger-ui-bundle.js", docs.ServeJS)
r.Get("/docs/swagger-ui.css", docs.ServeCSS)
r.Route("/v1", func(r chi.Router) {
r.Get("/pricing", pricing.Handle)