rts-sim-testing-service/main.go

49 lines
1.3 KiB
Go
Raw Normal View History

package main
import (
"fmt"
2023-07-14 16:28:47 +08:00
swaggerFiles "github.com/swaggo/files" // swagger embed files
ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware
"joylink.club/bj-rtsts-server/api"
"joylink.club/bj-rtsts-server/config"
2023-07-14 16:28:47 +08:00
"joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/dynamics"
"joylink.club/bj-rtsts-server/middleware"
)
2023-07-14 16:28:47 +08:00
// @title CBTC测试系统API
// @version 1.0
2023-07-14 16:28:47 +08:00
// @description CBTC测试服务.
// @host localhost:9091
2023-07-14 16:28:47 +08:00
// @BasePath /
2023-07-14 16:28:47 +08:00
// @securityDefinitions.apikey JwtAuth
// @in header
// @name Authorization
func main() {
engine := InitServer()
authMiddleware := middleware.InitGinJwtMiddleware()
router := engine.Group("/api")
api.InitUserRouter(router, authMiddleware)
2023-07-14 16:47:59 +08:00
api.InitDraftingRouter(router, authMiddleware)
2023-07-18 17:19:03 +08:00
api.InitPublishedGiRouter(router, authMiddleware)
2023-07-28 14:36:16 +08:00
api.InitSimulationRouter(router, authMiddleware)
api.InitCategoryRouter(router, authMiddleware)
2023-08-07 15:05:37 +08:00
api.InitGenerateGiRouter(router, authMiddleware)
2023-07-14 16:28:47 +08:00
docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
go dynamics.RunUdpServer()
serverConfig := config.Config.Server
if serverConfig.Port == 0 {
serverConfig.Port = 8080
}
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
}