mirror of https://github.com/zhufuyi/sponge
fix: use the default binding of gin
This commit is contained in:
parent
fa5e1921ce
commit
07f23f7b14
|
@ -12,11 +12,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/handlerfunc"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/validator"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
)
|
||||
|
||||
|
@ -36,7 +34,6 @@ func NewRouter(spongeAddr string, isLog bool) *gin.Engine {
|
|||
if isLog {
|
||||
r.Use(middleware.Logging(middleware.WithLog(logger.Get())))
|
||||
}
|
||||
binding.Validator = validator.Init()
|
||||
|
||||
// solve vue using history route 404 problem
|
||||
r.NoRoute(handlerfunc.BrowserRefreshFS(staticFS, "static/index.html"))
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
|
||||
|
@ -16,7 +15,6 @@ import (
|
|||
"github.com/go-dev-frame/sponge/pkg/gin/middleware"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/middleware/metrics"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/prof"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/validator"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
|
||||
"github.com/go-dev-frame/sponge/docs"
|
||||
|
@ -80,9 +78,6 @@ func NewRouter() *gin.Engine {
|
|||
prof.Register(r, prof.WithIOWaitTime())
|
||||
}
|
||||
|
||||
// validator
|
||||
binding.Validator = validator.Init()
|
||||
|
||||
r.GET("/health", handlerfunc.CheckHealth)
|
||||
r.GET("/ping", handlerfunc.Ping)
|
||||
r.GET("/codes", handlerfunc.ListCodes)
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"github.com/go-dev-frame/sponge/pkg/errcode"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/handlerfunc"
|
||||
|
@ -14,7 +13,6 @@ import (
|
|||
"github.com/go-dev-frame/sponge/pkg/gin/middleware/metrics"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/prof"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/swagger"
|
||||
"github.com/go-dev-frame/sponge/pkg/gin/validator"
|
||||
"github.com/go-dev-frame/sponge/pkg/logger"
|
||||
|
||||
"github.com/go-dev-frame/sponge/docs"
|
||||
|
@ -84,9 +82,6 @@ func NewRouter_pbExample() *gin.Engine { //nolint
|
|||
prof.Register(r, prof.WithIOWaitTime())
|
||||
}
|
||||
|
||||
// validator
|
||||
binding.Validator = validator.Init()
|
||||
|
||||
r.GET("/health", handlerfunc.CheckHealth)
|
||||
r.GET("/ping", handlerfunc.Ping)
|
||||
r.GET("/codes", handlerfunc.ListCodes)
|
||||
|
|
Loading…
Reference in New Issue