package router import ( "github.com/gin-gonic/gin" "server/api" ) // InitRouter 注册路由 func InitRouter() *gin.Engine { router := gin.Default() //设置路由组 Group := router.Group("api") { Group.GET("get", api.LoadData) Group.POST("saveDevice", api.SaveDevice) Group.POST("deviceLoopSwitch", api.DeviceLoopSwitch) Group.POST("deviceSwitch", api.DeviceSwitch) Group.POST("deviceBatchSwitch", api.BatchDeviceSwitch) Group.GET("getOnlineDevice", api.GetOnlineDevice) Group.GET("getSunDevices", api.GetSunDevices) Group.PUT("updateRegisterAddress", api.UpdateRegisterAddress) } return router }