refactor: 移除router包并将路由注册直接移至main.go
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
package router
|
|
||||||
|
|
||||||
import (
|
|
||||||
"digital-human/digitalhuman/controller"
|
|
||||||
|
|
||||||
"gitea.com/red-future/common/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Router() {
|
|
||||||
// 注册路由
|
|
||||||
http.RouteRegister([]interface{}{
|
|
||||||
controller.Audio, // 语音相关接口
|
|
||||||
controller.CustomVoice, // 自定义语音相关接口
|
|
||||||
controller.DigitalHuman, // 数字人相关接口
|
|
||||||
controller.Video, // 视频相关接口
|
|
||||||
controller.AsyncTask, // 异步任务相关接口
|
|
||||||
})
|
|
||||||
}
|
|
||||||
14
main.go
14
main.go
@@ -2,10 +2,10 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"digital-human/digitalhuman/controller"
|
||||||
digitalhuman "digital-human/digitalhuman/router"
|
|
||||||
|
|
||||||
_ "gitea.com/red-future/common/config"
|
_ "gitea.com/red-future/common/config"
|
||||||
|
"gitea.com/red-future/common/http"
|
||||||
"gitea.com/red-future/common/jaeger"
|
"gitea.com/red-future/common/jaeger"
|
||||||
_ "gitea.com/red-future/common/ragflow"
|
_ "gitea.com/red-future/common/ragflow"
|
||||||
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
||||||
@@ -16,8 +16,14 @@ func main() {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
defer jaeger.ShutDown(ctx)
|
defer jaeger.ShutDown(ctx)
|
||||||
// 注册路由
|
// 注册路由
|
||||||
digitalhuman.Router()
|
http.RouteRegister([]interface{}{
|
||||||
|
//digitalhuman相关接口
|
||||||
|
controller.Audio, // 语音相关接口
|
||||||
|
controller.CustomVoice, // 自定义语音相关接口
|
||||||
|
controller.DigitalHuman, // 数字人相关接口
|
||||||
|
controller.Video, // 视频相关接口
|
||||||
|
controller.AsyncTask, // 异步任务相关接口
|
||||||
|
})
|
||||||
// 保持应用运行
|
// 保持应用运行
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user