refactor(api): move Swagger UI to docs route

This commit is contained in:
2026-09-21 19:12:51 +03:30
parent 9328556c28
commit 099ec2150e
3 changed files with 13 additions and 8 deletions

View File

@@ -34,8 +34,8 @@ const swaggerUI = `<!doctype html>
// RegisterDocumentation registers the OpenAPI document and its Swagger UI.
func RegisterDocumentation(mux *http.ServeMux) {
mux.HandleFunc("GET /openapi.json", serveOpenAPI)
mux.HandleFunc("GET /swagger/", serveSwaggerUI)
mux.HandleFunc("GET /docs", redirectToSwaggerUI)
mux.HandleFunc("GET /docs/", serveSwaggerUI)
mux.HandleFunc("GET /docs", redirectToDocumentation)
}
func serveOpenAPI(w http.ResponseWriter, _ *http.Request) {
@@ -48,6 +48,6 @@ func serveSwaggerUI(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(swaggerUI))
}
func redirectToSwaggerUI(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/swagger/", http.StatusTemporaryRedirect)
func redirectToDocumentation(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/docs/", http.StatusTemporaryRedirect)
}