aboutsummaryrefslogblamecommitdiffstats
path: root/graphql/handler.go
blob: 0069ce44172f1c7ae2d0ca9aedf3bc99ef056da1 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                               

               
        
                                                      
                                                          
                                                   

                                          

 
                                                    
                                         
 
                                               
 
                                                                  
 
//go:generate gorunpkg github.com/vektah/gqlgen

package graphql

import (
	"github.com/MichaelMure/git-bug/graphql/graph"
	"github.com/MichaelMure/git-bug/graphql/resolvers"
	"github.com/MichaelMure/git-bug/repository"
	"github.com/vektah/gqlgen/handler"
	"net/http"
)

func NewHandler(repo repository.Repo) http.Handler {
	backend := resolvers.NewBackend()

	backend.RegisterDefaultRepository(repo)

	return handler.GraphQL(graph.NewExecutableSchema(backend))
}