rename handler files
This commit is contained in:
19
server/handlers/graphql.go
Normal file
19
server/handlers/graphql.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/99designs/gqlgen/graphql/handler"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/yauthdev/yauth/server/graph"
|
||||
"github.com/yauthdev/yauth/server/graph/generated"
|
||||
)
|
||||
|
||||
// Defining the Graphql handler
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user