aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/handler.go
blob: 507cb508b5b1861161755eb5bcf9e9c84cf51090 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//go:generate go run gen_graphql.go

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))
}