feat(legacy): setup routers in main.go
This commit is contained in:
parent
eb4f060cad
commit
5e23162fe2
10
main.go
10
main.go
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"hands/api"
|
"hands/api"
|
||||||
|
"hands/api/legacy"
|
||||||
"hands/cli"
|
"hands/cli"
|
||||||
"hands/config"
|
"hands/config"
|
||||||
"hands/device"
|
"hands/device"
|
||||||
@ -94,8 +95,15 @@ func main() {
|
|||||||
|
|
||||||
models.RegisterDeviceTypes()
|
models.RegisterDeviceTypes()
|
||||||
|
|
||||||
|
deviceManager := device.NewDeviceManager()
|
||||||
|
|
||||||
// 设置 API 路由
|
// 设置 API 路由
|
||||||
api.NewServer(device.NewDeviceManager()).SetupRoutes(r)
|
api.NewServer(deviceManager).SetupRoutes(r)
|
||||||
|
legacyServer, err := legacy.NewLegacyServer(deviceManager)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("❌ 初始化旧版 API 失败: %v", err)
|
||||||
|
}
|
||||||
|
legacyServer.SetupRoutes(r)
|
||||||
|
|
||||||
// 启动服务器
|
// 启动服务器
|
||||||
log.Printf("🌐 CAN 控制服务运行在 http://localhost:%s", config.Config.WebPort)
|
log.Printf("🌐 CAN 控制服务运行在 http://localhost:%s", config.Config.WebPort)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user