Update swagger route to /docs

This commit is contained in:
Tiago Yamamoto 2025-12-19 19:00:58 -03:00
parent 60078dd6aa
commit 632b35f6bb
4 changed files with 6 additions and 6 deletions

View file

@ -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 |

View file

@ -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

View file

@ -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
}

View file

@ -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
}