rts-sim-testing-service/main.go

43 lines
1.0 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/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:8080
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-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))
}