From 3aecbceef8bb059ad88cb67f036226d912076c3f Mon Sep 17 00:00:00 2001 From: "suguo.yao" Date: Tue, 20 Aug 2024 16:04:01 +0800 Subject: [PATCH] gin path remove --- gin2/gin.go | 6 +----- gin2/router-gin.go | 6 ++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/gin2/gin.go b/gin2/gin.go index 2fae7e4..8a3a8b6 100644 --- a/gin2/gin.go +++ b/gin2/gin.go @@ -23,10 +23,6 @@ var ( ) func Service() { - rootPath = os.Getenv("GIN_PATH") - if rootPath == "" { - rootPath = "/" - } addr = os.Getenv("GIN_ADDR") if addr == "" { addr = "0.0.0.0" @@ -42,7 +38,7 @@ func Service() { go func() { router := gin.New() - routerSetup(router, &rootPath) + routerSetup(router) if ssl == "true" { router.Use(tlsHandler()) diff --git a/gin2/router-gin.go b/gin2/router-gin.go index 6726202..1f07ed6 100644 --- a/gin2/router-gin.go +++ b/gin2/router-gin.go @@ -1,16 +1,14 @@ package gin import ( - "fmt" - "github.com/gin-gonic/gin" ) // 路由配置 -func routerSetup(router *gin.Engine, rootpath *string) { +func routerSetup(router *gin.Engine) { router.Use(gin.Recovery()) - r := router.Group(fmt.Sprintf("/%s", *rootpath)) + r := router.Group(`/`) { } }