Files
authorizer/server/handlers/graphql.go

20 lines
627 B
Go
Raw Normal View History

package handlers
import (
"github.com/99designs/gqlgen/graphql/handler"
2022-09-30 15:37:59 +05:30
graph "github.com/authorizerdev/authorizer/server/graph"
2021-07-23 21:57:44 +05:30
"github.com/authorizerdev/authorizer/server/graph/generated"
"github.com/gin-gonic/gin"
)
2022-01-17 11:32:13 +05:30
// GraphqlHandler is the main handler that handels all the graphql requests
func GraphqlHandler() gin.HandlerFunc {
// NewExecutableSchema and Config are in the generated.go file
// Resolver is in the resolver.go file
h := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{Resolvers: &graph.Resolver{}}))
return func(c *gin.Context) {
h.ServeHTTP(c.Writer, c.Request)
}
}