aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/handler.go
blob: d1906dda6aa86ada49500142c3f7327c507f8605 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//go:generate gorunpkg github.com/vektah/gqlgen

package graphql

import (
	"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.NewRootResolver()

	backend.RegisterDefaultRepository(repo)

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