generated from pkg/go-template
fix : changeName
continuous-integration/drone/push Build was killed
Details
continuous-integration/drone/push Build was killed
Details
parent
e1a46e17a4
commit
0c37f4363b
|
@ -52,7 +52,7 @@ func appInit() {
|
|||
//requestId
|
||||
app.Use(requestid.New())
|
||||
//recover
|
||||
app.Use(api.FibberRecoverHandler)
|
||||
app.Use(api.FibberMiddleWareRecoverHandler)
|
||||
//requestId for gorm
|
||||
app.Use(api.FibberUserCtxWithTraceHandler)
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
func main() {
|
||||
router := fiber.New(fiber.Config{
|
||||
AppName: "api-lark",
|
||||
ErrorHandler: api.FiberErrHandler,
|
||||
ErrorHandler: api.FiberMiddleWareErrHandler,
|
||||
})
|
||||
router.Use(api.FibberRespHandler)
|
||||
router.Use(api.FibberMiddleWareRespHandler)
|
||||
|
||||
userRouter := router.Group("/user")
|
||||
userRouter.Post("/login", user.LoginHandle)
|
||||
|
|
|
@ -11,8 +11,8 @@ import (
|
|||
"runtime"
|
||||
)
|
||||
|
||||
// FiberErrHandler fiber 错误处理的中间件
|
||||
func FiberErrHandler(ctx *fiber.Ctx, err error) error {
|
||||
// FiberMiddleWareErrHandler fiber 错误处理的中间件
|
||||
func FiberMiddleWareErrHandler(ctx *fiber.Ctx, err error) error {
|
||||
code := fiber.StatusInternalServerError
|
||||
msg := ""
|
||||
|
||||
|
@ -31,8 +31,8 @@ func FiberErrHandler(ctx *fiber.Ctx, err error) error {
|
|||
})
|
||||
}
|
||||
|
||||
// FibberRespHandler fiber resp的统一处理
|
||||
func FibberRespHandler(c *fiber.Ctx) error {
|
||||
// FibberMiddleWareRespHandler fiber resp的统一处理
|
||||
func FibberMiddleWareRespHandler(c *fiber.Ctx) error {
|
||||
err := c.Next()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -50,8 +50,8 @@ func FibberRespHandler(c *fiber.Ctx) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// FibberRecoverHandler fiberPanicRecover
|
||||
func FibberRecoverHandler() fiber.Handler {
|
||||
// FibberMiddleWareRecoverHandler fiberPanicRecover
|
||||
func FibberMiddleWareRecoverHandler() fiber.Handler {
|
||||
return recover.New(recover.Config{
|
||||
EnableStackTrace: true,
|
||||
StackTraceHandler: func(c *fiber.Ctx, e interface{}) {
|
||||
|
|
Loading…
Reference in New Issue