123456789101112131415161718192021222324 |
- package router
- import (
- "github.com/gin-gonic/gin"
- "iot_manager_service/app/controller"
- "iot_manager_service/app/middleware"
- )
- func InitRouter(engine *gin.Engine) {
- // 跨域处理
- engine.Use(middleware.Cors())
- // 登录验证中间件
- engine.Use(middleware.CheckLogin())
- // 校验权限
- engine.Use(middleware.CheckAuth())
- // 设备管理
- device := engine.Group("/api/longchi/device")
- camera := device.Group("/camera")
- {
- camera.GET("/detail", controller.Camera.Detail)
- camera.POST("/submit", controller.Camera.CreateOrUpdate)
- }
- }
|