diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 805ce11..5dfdb56 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -27,6 +27,10 @@ export default defineConfig({ target: 'http://localhost:8080', changeOrigin: true, }, + '/swagger': { + target: 'http://localhost:8080', + changeOrigin: true, + }, }, }, build: { diff --git a/server/cmd/server/main.go b/server/cmd/server/main.go index c672d53..9c0dbd2 100644 --- a/server/cmd/server/main.go +++ b/server/cmd/server/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" + _ "github.com/1024XEngineer/xinfra/server/docs" "github.com/1024XEngineer/xinfra/server/internal/handler" "github.com/1024XEngineer/xinfra/server/internal/middleware" "github.com/gin-gonic/gin" @@ -22,7 +23,6 @@ import ( // @license.name Apache 2.0 // @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @host localhost:8080 // @BasePath /api/v1 // @securityDefinitions.apikey BearerAuth diff --git a/server/docs/docs.go b/server/docs/docs.go index c46c09a..9a6275c 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -350,7 +350,7 @@ const docTemplate = `{ // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", - Host: "localhost:8080", + Host: "", BasePath: "/api/v1", Schemes: []string{}, Title: "xinfra API", diff --git a/server/docs/swagger.json b/server/docs/swagger.json index 6d86f6e..17a1625 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -15,7 +15,6 @@ }, "version": "1.0" }, - "host": "localhost:8080", "basePath": "/api/v1", "paths": { "/ping": { diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index a7a8ff3..183efc1 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -20,7 +20,6 @@ definitions: description: 响应消息 type: string type: object -host: localhost:8080 info: contact: email: support@swagger.io