From cab289dabfc7ed0bbe42d6caf8118a97f4111593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=94=A6=E5=BC=BA?= <1061669148@qq.com> Date: Fri, 14 Mar 2025 20:47:37 +0800 Subject: [PATCH] feat: refactor routing structure by moving routes to a dedicated package and updating service initialization --- internal/http/{server => routes}/routes.go | 2 +- internal/http/server/app.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename internal/http/{server => routes}/routes.go (99%) diff --git a/internal/http/server/routes.go b/internal/http/routes/routes.go similarity index 99% rename from internal/http/server/routes.go rename to internal/http/routes/routes.go index 77f9b5a..c9ef076 100644 --- a/internal/http/server/routes.go +++ b/internal/http/routes/routes.go @@ -1,4 +1,4 @@ -package server +package routes import ( "net/http" diff --git a/internal/http/server/app.go b/internal/http/server/app.go index f7e328f..51d2ca8 100644 --- a/internal/http/server/app.go +++ b/internal/http/server/app.go @@ -9,6 +9,7 @@ import ( "syscall" "time" "tts/internal/config" + "tts/internal/http/routes" ) // App 表示整个TTS应用程序 @@ -26,13 +27,13 @@ func NewApp(configPath string) (*App, error) { } // 初始化服务 - ttsService, err := InitializeServices(cfg) + ttsService, err := routes.InitializeServices(cfg) if err != nil { return nil, fmt.Errorf("初始化服务失败: %w", err) } // 设置路由 - handler, err := SetupRoutes(cfg, ttsService) + handler, err := routes.SetupRoutes(cfg, ttsService) if err != nil { return nil, fmt.Errorf("设置路由失败: %w", err) }