rts-sim-testing-service/main.go

45 lines
1.1 KiB
Go

package main
import (
"fmt"
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"
"joylink.club/bj-rtsts-server/docs"
"joylink.club/bj-rtsts-server/middleware"
)
// @title CBTC测试系统API
// @version 1.0
// @description CBTC测试服务.
// @host localhost:8080
// @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)
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))
}