|
@@ -69,18 +69,25 @@ func main() {
|
|
|
go service.RunWaitingCluster()
|
|
|
|
|
|
// 启动 web 服务器
|
|
|
- router := gin.Default()
|
|
|
- //router.Use(commonHandler.ValidateHeaders()) // todo 暂时不需要校验
|
|
|
- router.Use(middleware.Cors()) // 解决cors
|
|
|
- api1 := router.Group(infra.ApplicationYaml.Web.RoutePrefix)
|
|
|
- api1.POST("/start-project", handler.StartProject)
|
|
|
- api2 := router.Group("/simulation/resource/scheduler/task")
|
|
|
- api2.GET("/confirm", handler.Confirm)
|
|
|
- api2.GET("/tick", handler.Tick)
|
|
|
- api2.GET("/state", handler.State)
|
|
|
- err := router.Run(":" + infra.ApplicationYaml.Web.Port)
|
|
|
- if err != nil {
|
|
|
- infra.GlobalLogger.Error("程序崩溃,监听端口 " + util.ToString(infra.ApplicationYaml.Web.Port) + " 失败。")
|
|
|
- os.Exit(-1)
|
|
|
+ {
|
|
|
+ router := gin.Default()
|
|
|
+ router.Use(middleware.Cors()) // 解决cors
|
|
|
+ {
|
|
|
+ api1 := router.Group(infra.ApplicationYaml.Web.RoutePrefix)
|
|
|
+ api1.POST("/start-project", handler.StartProject)
|
|
|
+ }
|
|
|
+ {
|
|
|
+ api2 := router.Group("/simulation/resource/scheduler/task")
|
|
|
+ api2.GET("/confirm", handler.Confirm)
|
|
|
+ api2.GET("/tick", handler.Tick)
|
|
|
+ api2.GET("/state", handler.State)
|
|
|
+ }
|
|
|
+
|
|
|
+ err := router.Run(":" + infra.ApplicationYaml.Web.Port)
|
|
|
+ if err != nil {
|
|
|
+ infra.GlobalLogger.Error("程序崩溃,监听端口 " + util.ToString(infra.ApplicationYaml.Web.Port) + " 失败。")
|
|
|
+ os.Exit(-1)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|