From 632b35f6bbdce29c2896131717362e89325285b9 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Fri, 19 Dec 2025 19:00:58 -0300 Subject: [PATCH] Update swagger route to /docs --- README.md | 2 +- backend/README.md | 4 ++-- backend/internal/server/server.go | 4 ++-- start.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 16691f5..de34f9d 100644 --- a/README.md +++ b/README.md @@ -392,7 +392,7 @@ docker-compose up | Serviço | URL | Descrição | |---------|-----|-----------| | Backend API | http://localhost:8080 | API Go | -| Backend Swagger | http://localhost:8080/swagger/index.html | Docs API Go | +| Backend Swagger | http://localhost:8080/docs/index.html | Docs API Go | | Backoffice | http://localhost:3000 | Admin NestJS | | Backoffice Swagger | http://localhost:3000/api | Docs NestJS | | Marketplace | http://localhost:5173 | Frontend React | diff --git a/backend/README.md b/backend/README.md index 0ca1c6f..3f90cd4 100644 --- a/backend/README.md +++ b/backend/README.md @@ -91,7 +91,7 @@ go mod download go run ./cmd/api # API estará disponível em http://localhost:8080 -# Swagger UI em http://localhost:8080/swagger/index.html +# Swagger UI em http://localhost:8080/docs/index.html ``` ## 🐳 Docker @@ -111,7 +111,7 @@ docker run -p 8080:8080 \ A documentação completa da API está disponível via Swagger UI: ``` -http://localhost:8080/swagger/index.html +http://localhost:8080/docs/index.html ``` ### Regenerar Swagger diff --git a/backend/internal/server/server.go b/backend/internal/server/server.go index 6daa816..9915cfa 100644 --- a/backend/internal/server/server.go +++ b/backend/internal/server/server.go @@ -50,7 +50,7 @@ func New(cfg config.Config) (*Server, error) { } w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - response := `{"message":"💊 SaveInMed API is running!","docs":"/swagger/index.html","health":"/health","version":"1.0.0"}` + response := `{"message":"💊 SaveInMed API is running!","docs":"/docs/index.html","health":"/health","version":"1.0.0"}` _, _ = w.Write([]byte(response)) }) @@ -109,7 +109,7 @@ func New(cfg config.Config) (*Server, error) { mux.Handle("GET /api/v1/cart", chain(http.HandlerFunc(h.GetCart), middleware.Logger, middleware.Gzip, auth)) mux.Handle("DELETE /api/v1/cart/", chain(http.HandlerFunc(h.DeleteCartItem), middleware.Logger, middleware.Gzip, auth)) - mux.Handle("GET /swagger/", httpSwagger.Handler(httpSwagger.URL("/swagger/doc.json"))) + mux.Handle("GET /docs/", httpSwagger.Handler(httpSwagger.URL("/docs/doc.json"))) return &Server{cfg: cfg, db: db, mux: mux}, nil } diff --git a/start.sh b/start.sh index 05f8abb..f8408db 100755 --- a/start.sh +++ b/start.sh @@ -142,7 +142,7 @@ start_backend() { echo -e "${GREEN} ▶ Executando: go run ./cmd/api${NC}" echo -e "${CYAN} 📍 API disponível em: http://localhost:${PORT:-8214}${NC}" - echo -e "${CYAN} 📚 Swagger UI: http://localhost:${PORT:-8214}/swagger/index.html${NC}\n" + echo -e "${CYAN} 📚 Swagger UI: http://localhost:${PORT:-8214}/docs/index.html${NC}\n" go run ./cmd/api }