feat 协议移动到Public

This commit is contained in:
2025-12-15 11:22:59 +08:00
parent 6e19d93f5e
commit 3498cf158d
45 changed files with 2730 additions and 929 deletions

View File

@@ -2,14 +2,14 @@ package http_gateway
import (
"common/log"
"gateway/config"
"gateway/handler/http_handler"
"gateway/handler/http_handler/helper/render"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
"net/http"
)
func InitRouter(cfg *config.Config) *gin.Engine {
func InitRouter() *gin.Engine {
gin.SetMode(gin.ReleaseMode)
r := gin.New()
@@ -21,16 +21,10 @@ func InitRouter(cfg *config.Config) *gin.Engine {
r.HandleMethodNotAllowed = true
r.NoMethod(func(c *gin.Context) {
c.JSON(http.StatusMethodNotAllowed, gin.H{
"result": false,
"error": "Method Not Allowed",
})
render.JsonByStatus(c, http.StatusMethodNotAllowed, render.Failed, "Method Not Allowed")
})
r.NoRoute(func(c *gin.Context) {
c.JSON(http.StatusNotFound, gin.H{
"result": false,
"error": "Endpoint Not Found",
})
render.JsonByStatus(c, http.StatusNotFound, render.Failed, "Endpoint Not Found")
})
initBaseRouter(r)