rts-sim-testing-service/main.go
2023-10-08 09:34:00 +08:00

53 lines
1.4 KiB
Go

package main
import (
"fmt"
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"joylink.club/bj-rtsts-server/api"
"joylink.club/bj-rtsts-server/config"
"joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/dynamics"
"joylink.club/bj-rtsts-server/middleware"
"joylink.club/bj-rtsts-server/vobc"
)
// @title CBTC测试系统API
// @version 1.0
// @description CBTC测试服务.
// @host localhost:9091
// @BasePath /
// @securityDefinitions.apikey JwtAuth
// @in header
// @name Authorization
func main() {
engine := InitServer()
authMiddleware := middleware.InitGinJwtMiddleware()
router := engine.Group("/api")
api.InitUserRouter(router, authMiddleware)
api.InitDraftingRouter(router, authMiddleware)
api.InitPublishedGiRouter(router, authMiddleware)
api.InitSimulationRouter(router, authMiddleware)
api.InitCategoryRouter(router, authMiddleware)
api.InitProjectRouter(router, authMiddleware)
api.InitTrainManageRouter(router, authMiddleware)
api.InitProjectLinkRouter(router, authMiddleware)
api.InitAuthRouter(router, authMiddleware)
docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
go dynamics.RunUdpServer()
go vobc.RunUdpServer()
serverConfig := config.Config.Server
if serverConfig.Port == 0 {
serverConfig.Port = 8080
}
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
}