diff --git a/router/handler/onvif_handler.go b/router/handler/onvif_handler.go new file mode 100644 index 0000000..02a2076 --- /dev/null +++ b/router/handler/onvif_handler.go @@ -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"}) +} diff --git a/router/router.go b/router/router.go new file mode 100644 index 0000000..0cb466a --- /dev/null +++ b/router/router.go @@ -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) + } + } +}