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
|
//requestId
|
||||||
app.Use(requestid.New())
|
app.Use(requestid.New())
|
||||||
//recover
|
//recover
|
||||||
app.Use(api.FibberRecoverHandler)
|
app.Use(api.FibberMiddleWareRecoverHandler)
|
||||||
//requestId for gorm
|
//requestId for gorm
|
||||||
app.Use(api.FibberUserCtxWithTraceHandler)
|
app.Use(api.FibberUserCtxWithTraceHandler)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
func main() {
|
func main() {
|
||||||
router := fiber.New(fiber.Config{
|
router := fiber.New(fiber.Config{
|
||||||
AppName: "api-lark",
|
AppName: "api-lark",
|
||||||
ErrorHandler: api.FiberErrHandler,
|
ErrorHandler: api.FiberMiddleWareErrHandler,
|
||||||
})
|
})
|
||||||
router.Use(api.FibberRespHandler)
|
router.Use(api.FibberMiddleWareRespHandler)
|
||||||
|
|
||||||
userRouter := router.Group("/user")
|
userRouter := router.Group("/user")
|
||||||
userRouter.Post("/login", user.LoginHandle)
|
userRouter.Post("/login", user.LoginHandle)
|
||||||
|
|
|
@ -11,8 +11,8 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FiberErrHandler fiber 错误处理的中间件
|
// FiberMiddleWareErrHandler fiber 错误处理的中间件
|
||||||
func FiberErrHandler(ctx *fiber.Ctx, err error) error {
|
func FiberMiddleWareErrHandler(ctx *fiber.Ctx, err error) error {
|
||||||
code := fiber.StatusInternalServerError
|
code := fiber.StatusInternalServerError
|
||||||
msg := ""
|
msg := ""
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ func FiberErrHandler(ctx *fiber.Ctx, err error) error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// FibberRespHandler fiber resp的统一处理
|
// FibberMiddleWareRespHandler fiber resp的统一处理
|
||||||
func FibberRespHandler(c *fiber.Ctx) error {
|
func FibberMiddleWareRespHandler(c *fiber.Ctx) error {
|
||||||
err := c.Next()
|
err := c.Next()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -50,8 +50,8 @@ func FibberRespHandler(c *fiber.Ctx) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FibberRecoverHandler fiberPanicRecover
|
// FibberMiddleWareRecoverHandler fiberPanicRecover
|
||||||
func FibberRecoverHandler() fiber.Handler {
|
func FibberMiddleWareRecoverHandler() fiber.Handler {
|
||||||
return recover.New(recover.Config{
|
return recover.New(recover.Config{
|
||||||
EnableStackTrace: true,
|
EnableStackTrace: true,
|
||||||
StackTraceHandler: func(c *fiber.Ctx, e interface{}) {
|
StackTraceHandler: func(c *fiber.Ctx, e interface{}) {
|
||||||
|
|
Loading…
Reference in New Issue