diff --git a/backend/main.go b/backend/main.go index 65d08fa..8be777b 100644 --- a/backend/main.go +++ b/backend/main.go @@ -72,10 +72,12 @@ func main() { setupRouter(injector) migrateTo3(tx, myLogger) + e.HideBanner = true - myLogger.Info().Msgf("服务端启动成功,监听:%d端口...", cfg.Port) err = e.Start(fmt.Sprintf(":%d", cfg.Port)) - if err != nil { + if err == nil { + myLogger.Info().Msgf("服务端启动成功,监听:%d端口...", cfg.Port) + } else { myLogger.Fatal().Msgf("服务启动失败,错误原因:%s", err) } } diff --git a/backend/main_prod.go b/backend/main_prod.go index 622ddea..749e976 100644 --- a/backend/main_prod.go +++ b/backend/main_prod.go @@ -6,6 +6,7 @@ import ( "embed" "fmt" "net/http" + "strings" "github.com/ilyakaznacheev/cleanenv" _ "github.com/joho/godotenv/autoload" @@ -81,15 +82,22 @@ func main() { HTML5: true, Root: "public", // because files are located in `web` directory in `webAssets` fs Filesystem: http.FS(staticFiles), - })) + Skipper: func(c echo.Context) bool { + if strings.HasPrefix(c.Request().URL.Path, "/swagger/") { + return true + } - e.FileFS("/*", "public/index.html", staticFiles) + return false + }, + })) migrateTo3(tx, myLogger) + e.HideBanner = true - myLogger.Info().Msgf("服务端启动成功,监听:%d端口...", cfg.Port) err = e.Start(fmt.Sprintf(":%d", cfg.Port)) - if err != nil { + if err == nil { + myLogger.Info().Msgf("服务端启动成功,监听:%d端口...", cfg.Port) + } else { myLogger.Fatal().Msgf("服务启动失败,错误原因:%s", err) } } diff --git a/front/nuxt.config.ts b/front/nuxt.config.ts index bfaf04f..2d2bf51 100644 --- a/front/nuxt.config.ts +++ b/front/nuxt.config.ts @@ -49,7 +49,11 @@ export default defineNuxtConfig({ "/upload": { target: "http://localhost:37892", changeOrigin: true, - } + }, + "/swagger": { + target: "http://localhost:37892", + changeOrigin: true, + }, }, }, build: {