Update swagger route to /docs
This commit is contained in:
parent
60078dd6aa
commit
632b35f6bb
4 changed files with 6 additions and 6 deletions
|
|
@ -392,7 +392,7 @@ docker-compose up
|
||||||
| Serviço | URL | Descrição |
|
| Serviço | URL | Descrição |
|
||||||
|---------|-----|-----------|
|
|---------|-----|-----------|
|
||||||
| Backend API | http://localhost:8080 | API Go |
|
| 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 | http://localhost:3000 | Admin NestJS |
|
||||||
| Backoffice Swagger | http://localhost:3000/api | Docs NestJS |
|
| Backoffice Swagger | http://localhost:3000/api | Docs NestJS |
|
||||||
| Marketplace | http://localhost:5173 | Frontend React |
|
| Marketplace | http://localhost:5173 | Frontend React |
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ go mod download
|
||||||
go run ./cmd/api
|
go run ./cmd/api
|
||||||
|
|
||||||
# API estará disponível em http://localhost:8080
|
# 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
|
## 🐳 Docker
|
||||||
|
|
@ -111,7 +111,7 @@ docker run -p 8080:8080 \
|
||||||
A documentação completa da API está disponível via Swagger UI:
|
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
|
### Regenerar Swagger
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ func New(cfg config.Config) (*Server, error) {
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
w.WriteHeader(http.StatusOK)
|
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))
|
_, _ = 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("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("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
|
return &Server{cfg: cfg, db: db, mux: mux}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
start.sh
2
start.sh
|
|
@ -142,7 +142,7 @@ start_backend() {
|
||||||
|
|
||||||
echo -e "${GREEN} ▶ Executando: go run ./cmd/api${NC}"
|
echo -e "${GREEN} ▶ Executando: go run ./cmd/api${NC}"
|
||||||
echo -e "${CYAN} 📍 API disponível em: http://localhost:${PORT:-8214}${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
|
go run ./cmd/api
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue