From 7047d896f8e6234e924bdae008f4b38816ad970d Mon Sep 17 00:00:00 2001 From: imbytecat Date: Thu, 22 Aug 2024 09:50:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=8B=86=E5=88=86=20router=20(part=20?= =?UTF-8?q?I)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/handler/onvif_handler.go | 16 ++++++++++++++++ router/router.go | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 router/handler/onvif_handler.go create mode 100644 router/router.go 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) + } + } +}