router.go 515 B

123456789101112131415161718192021222324
  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("deviceLoopSwitch", api.DeviceLoopSwitch)
  15. Group.POST("deviceSwitch", api.DeviceSwitch)
  16. Group.POST("deviceBatchSwitch", api.BatchDeviceSwitch)
  17. Group.GET("getOnlineDevice", api.GetOnlineDevice)
  18. }
  19. return router
  20. }