rts-sim-testing-service/main.go

51 lines
1.4 KiB
Go
Raw Normal View History

package main
import (
"fmt"
2023-08-30 09:28:21 +08:00
2023-08-25 15:37:29 +08:00
swaggerFiles "github.com/swaggo/files"
ginSwagger "github.com/swaggo/gin-swagger"
"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/middleware"
"joylink.club/bj-rtsts-server/third_party"
)
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()
third_party.Init()
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)
api.InitProjectRouter(router, authMiddleware)
api.InitTrainManageRouter(router, authMiddleware)
api.InitProjectLinkRouter(router, authMiddleware)
2023-08-30 09:28:21 +08:00
api.InitAuthRouter(router, authMiddleware)
2023-07-14 16:28:47 +08:00
docs.SwaggerInfo.Title = "CBTC测试系统API"
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
serverConfig := config.Config.Server
if serverConfig.Port == 0 {
serverConfig.Port = 8080
}
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
}