router.go 551 B

123456789101112131415161718192021222324
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "iot_manager_service/app/controller"
  5. "iot_manager_service/app/middleware"
  6. )
  7. func InitRouter(engine *gin.Engine) {
  8. // 跨域处理
  9. engine.Use(middleware.Cors())
  10. // 登录验证中间件
  11. engine.Use(middleware.CheckLogin())
  12. // 校验权限
  13. engine.Use(middleware.CheckAuth())
  14. // 设备管理
  15. device := engine.Group("/api/longchi/device")
  16. camera := device.Group("/camera")
  17. {
  18. camera.GET("/detail", controller.Camera.Detail)
  19. camera.POST("/submit", controller.Camera.CreateOrUpdate)
  20. }
  21. }