feat 协议移动到Public
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user