feat: refactor routing structure by moving routes to a dedicated package and updating service initialization

This commit is contained in:
王锦强
2025-03-14 20:47:37 +08:00
parent 39c776998e
commit cab289dabf
2 changed files with 4 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
package server
package routes
import (
"net/http"

View File

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