router.go 715 B

12345678910111213141516171819202122232425262728
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "server/api"
  5. )
  6. // InitRouter 注册路由
  7. func InitRouter() *gin.Engine {
  8. router := gin.Default()
  9. //设置路由组
  10. Group := router.Group("api")
  11. {
  12. Group.GET("get", api.LoadData)
  13. Group.POST("saveDevice", api.SaveDevice)
  14. Group.POST("deviceSave", api.DeviceSave)
  15. Group.POST("devicesSave", api.DevicesSave)
  16. Group.POST("deviceLoopSwitch", api.DeviceLoopSwitch)
  17. Group.POST("deviceSwitch", api.DeviceSwitch)
  18. Group.POST("deviceBatchSwitch", api.BatchDeviceSwitch)
  19. Group.GET("getOnlineDevice", api.GetOnlineDevice)
  20. Group.GET("getSunDevices", api.GetSunDevices)
  21. Group.PUT("updateRegisterAddress", api.UpdateRegisterAddress)
  22. }
  23. return router
  24. }