git-bug/graphql/handler.go

19 lines
425 B
Go
Raw Normal View History

2018-07-29 19:58:42 +03:00
//go:generate gorunpkg github.com/vektah/gqlgen
2018-07-19 15:15:50 +03:00
package graphql
import (
2018-07-29 19:58:42 +03:00
"github.com/MichaelMure/git-bug/graphql/resolvers"
"github.com/MichaelMure/git-bug/repository"
2018-07-29 19:58:42 +03:00
"github.com/vektah/gqlgen/handler"
"net/http"
)
2018-07-29 19:58:42 +03:00
func NewHandler(repo repository.Repo) http.Handler {
backend := resolvers.NewRootResolver()
2018-07-29 19:58:42 +03:00
backend.RegisterDefaultRepository(repo)
2018-07-29 19:58:42 +03:00
return handler.GraphQL(resolvers.NewExecutableSchema(backend))
2018-07-19 15:15:50 +03:00
}