diff --git a/server/handlers/oauthCallback.go b/server/handlers/oauthCallback.go index e74b2e9..a068622 100644 --- a/server/handlers/oauthCallback.go +++ b/server/handlers/oauthCallback.go @@ -163,7 +163,7 @@ func processGithubUserInfo(state string, code string, c *gin.Context) error { return nil } -func HandleOAuthCallback(provider enum.OAuthProvider) gin.HandlerFunc { +func OAuthCallbackHandler(provider enum.OAuthProvider) gin.HandlerFunc { return func(c *gin.Context) { var err error if provider == enum.GoogleProvider { diff --git a/server/handlers/oauthLogin.go b/server/handlers/oauthLogin.go index b55786c..c18c61a 100644 --- a/server/handlers/oauthLogin.go +++ b/server/handlers/oauthLogin.go @@ -10,7 +10,7 @@ import ( "github.com/yauthdev/yauth/server/session" ) -func HandleOAuthLogin(provider enum.OAuthProvider) gin.HandlerFunc { +func OAuthLoginHandler(provider enum.OAuthProvider) gin.HandlerFunc { uuid := uuid.New() oauthStateString := uuid.String() diff --git a/server/handlers/playground.go b/server/handlers/playground.go index cbb2022..00f3990 100644 --- a/server/handlers/playground.go +++ b/server/handlers/playground.go @@ -5,7 +5,6 @@ import ( "github.com/gin-gonic/gin" ) -// Defining the Playground handler func PlaygroundHandler() gin.HandlerFunc { h := playground.Handler("GraphQL", "/graphql") diff --git a/server/handlers/verifyEmail.go b/server/handlers/verifyEmail.go index 821a015..39f48fb 100644 --- a/server/handlers/verifyEmail.go +++ b/server/handlers/verifyEmail.go @@ -13,8 +13,7 @@ import ( "github.com/yauthdev/yauth/server/utils" ) -// Defining the Graphql handler -func VerifyEmail() gin.HandlerFunc { +func VerifyEmailHandler() gin.HandlerFunc { return func(c *gin.Context) { errorRes := gin.H{ "message": "invalid token", diff --git a/server/server.go b/server/server.go index 373da0d..25c3984 100644 --- a/server/server.go +++ b/server/server.go @@ -42,14 +42,14 @@ func main() { r.Use(CORSMiddleware()) r.GET("/", handlers.PlaygroundHandler()) r.POST("/graphql", handlers.GraphqlHandler()) - r.GET("/verify_email", handlers.VerifyEmail()) + r.GET("/verify_email", handlers.VerifyEmailHandler()) if oauth.OAuthProvider.GoogleConfig != nil { - r.GET("/login/google", handlers.HandleOAuthLogin(enum.GoogleProvider)) - r.GET("/callback/google", handlers.HandleOAuthCallback(enum.GoogleProvider)) + r.GET("/login/google", handlers.OAuthLoginHandler(enum.GoogleProvider)) + r.GET("/callback/google", handlers.OAuthCallbackHandler(enum.GoogleProvider)) } if oauth.OAuthProvider.GithubConfig != nil { - r.GET("/login/github", handlers.HandleOAuthLogin(enum.GithubProvider)) - r.GET("/callback/github", handlers.HandleOAuthCallback(enum.GithubProvider)) + r.GET("/login/github", handlers.OAuthLoginHandler(enum.GithubProvider)) + r.GET("/callback/github", handlers.OAuthCallbackHandler(enum.GithubProvider)) } r.Run() }