1、修改路由
This commit is contained in:
parent
3532dc294e
commit
deaccf048d
|
@ -14,10 +14,11 @@ import (
|
||||||
func InitRouter(logger *zap.Logger, engine *xorm.Engine) *gin.Engine {
|
func InitRouter(logger *zap.Logger, engine *xorm.Engine) *gin.Engine {
|
||||||
hs := handler.NewHandlerService(engine, logger)
|
hs := handler.NewHandlerService(engine, logger)
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
r := gin.New()
|
root := gin.New()
|
||||||
r.Use(ginzap.Ginzap(logger, "2006-01-02 15:04:05.000", true))
|
root.Use(ginzap.Ginzap(logger, "2006-01-02 15:04:05.000", true))
|
||||||
r.Use(middleware.Cors())
|
root.Use(middleware.Cors())
|
||||||
|
r := root.Group("/api")
|
||||||
|
{
|
||||||
user := r.Group("/user")
|
user := r.Group("/user")
|
||||||
{
|
{
|
||||||
user.Use(middleware.JwtAuthMiddleware(logger))
|
user.Use(middleware.JwtAuthMiddleware(logger))
|
||||||
|
@ -104,5 +105,6 @@ func InitRouter(logger *zap.Logger, engine *xorm.Engine) *gin.Engine {
|
||||||
model.POST("/edit", e.ErrorWrapper(hs.EditModel))
|
model.POST("/edit", e.ErrorWrapper(hs.EditModel))
|
||||||
model.POST("/delete", e.ErrorWrapper(hs.DelModel))
|
model.POST("/delete", e.ErrorWrapper(hs.DelModel))
|
||||||
}
|
}
|
||||||
return r
|
}
|
||||||
|
return root
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue