1

概括

您好,我正面临来自客户端的 GO Echo API 调用的非常奇怪的行为,它有时会停止提供随机发生的 API 调用的输出,我可以在请求中看到通过记录器注册的日志,但它一直处于等待状态。下面是我的代码。我一直在检查 signInWithEmail API。任何帮助将不胜感激

完整代码

package main

    func main() {
        flag.Parse()
        d: = connection.CreateConnection(*config.Env)

        e: = echo.New()

        e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig {
            Format: "\nmethod=${method}, header=${header:Content-Type}, host=${host}, uri=${uri}, status=${status}\n",
        }))
        e.Use(middleware.GzipWithConfig(middleware.GzipConfig {
            Level: 1,
        }))
        e.Use(middleware.Recover())

        e.Logger.SetLevel(log.DEBUG)

        e.Use(middleware.CORSWithConfig(middleware.CORSConfig {
            AllowOrigins: [] string {
                "*"
            },
            AllowHeaders: [] string {},
            AllowMethods: [] string {
                echo.GET, echo.PUT, echo.POST, echo.DELETE
            },
        }))

        e.Use(middleware.BodyDump(func(c echo.Context, reqBody, resBody[] byte) {
            fmt.Println("reqBody", string(reqBody))
        }))

        configjwt: = middleware.JWTConfig {
            Claims: & config.JwtCustomClaims {},
            SigningKey: [] byte(config.SECRET_KEY),
        }

        e.GET(config.API_BASE_URL + "/generateToken", models.Createtoken)
        e.GET("/checktoken", models.Checktoken)

        h1: = handlers.NewUserHandler(models.NewUserModel(d))
        e.POST(config.API_BASE_URL + "/guestLogin", h1.GuestLogin, handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/signInWithEmail", h1.SignInWithEmail, handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/signUpWithFacebook", h1.SignUpWithFacebook, handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/signUpWithEmail", h1.SignUpWithEmail, handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/forgotPassword", h1.ForgotPassword, handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/resetPassword", h1.ResetPassword, handlers.LangMiddleware())

        e.POST(config.API_BASE_URL + "/logout", h1.Logout, middleware.JWTWithConfig(configjwt), handlers.LangMiddleware())
        e.PUT(config.API_BASE_URL + "/changePassword", h1.ChangePassword, middleware.JWTWithConfig(configjwt), handlers.AuthMiddleware(d), handlers.LangMiddleware())

        e.POST(config.API_BASE_URL + "/contact-us", h1.ContactUs, handlers.LangMiddleware())

        h2: = handlers.NewBillDetailsHandler(models.NewBillDetailsModel(d))
        e.POST(config.API_BASE_URL + "/syncData", h2.SyncData, middleware.JWTWithConfig(configjwt), handlers.LangMiddleware())
        e.GET(config.API_BASE_URL + "/syncData", h2.GetSyncData, middleware.JWTWithConfig(configjwt), handlers.LangMiddleware())

        h3: = handlers.NewShareRequestHandler(models.NewShareRequestModel(d))
        e.POST(config.API_BASE_URL + "/invite", h3.ShareRequest, middleware.JWTWithConfig(configjwt), handlers.LangMiddleware())
        e.GET(config.API_BASE_URL + "/inviteelistData", h3.GetInviteeListData, middleware.JWTWithConfig(configjwt), handlers.LangMiddleware())
        e.POST(config.API_BASE_URL + "/acceptinviteRequest", h3.AcceptShareRequest, handlers.LangMiddleware())

        e.Logger.Fatal(e.Start(":" + * config.HTTPAddr))
    }
4

0 回答 0