123456789101112131415161718192021222324252627 |
- 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("deviceSave", api.DeviceSave)
- Group.POST("devicesSave", api.DevicesSave)
- 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)
- }
- return router
- }
|