chore: 拆分 router (part I)
This commit is contained in:
parent
23218acc18
commit
7047d896f8
16
router/handler/onvif_handler.go
Normal file
16
router/handler/onvif_handler.go
Normal file
@ -0,0 +1,16 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetConnections(c *gin.Context) {
|
||||
// 这里可以添加获取产品的逻辑
|
||||
c.JSON(http.StatusOK, gin.H{"message": "Get Connections"})
|
||||
}
|
||||
|
||||
func CreateConnection(c *gin.Context) {
|
||||
// 这里可以添加创建产品的逻辑
|
||||
c.JSON(http.StatusCreated, gin.H{"message": "Connection Created"})
|
||||
}
|
18
router/router.go
Normal file
18
router/router.go
Normal file
@ -0,0 +1,18 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"onvif-agent/router/handler"
|
||||
)
|
||||
|
||||
func SetupRoutes(r *gin.Engine) {
|
||||
// ONVIF 相关路由
|
||||
userGroup := r.Group("/onvif")
|
||||
{
|
||||
connectionGroup := userGroup.Group("/connections")
|
||||
{
|
||||
connectionGroup.GET("/", handler.GetConnections)
|
||||
connectionGroup.POST("/", handler.CreateConnection)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user