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
|
|
|
|
|
2018-07-20 01:25:30 +03:00
|
|
|
import (
|
2018-07-29 19:58:42 +03:00
|
|
|
"github.com/MichaelMure/git-bug/graphql/resolvers"
|
2018-07-20 01:25:30 +03:00
|
|
|
"github.com/MichaelMure/git-bug/repository"
|
2018-07-29 19:58:42 +03:00
|
|
|
"github.com/vektah/gqlgen/handler"
|
|
|
|
"net/http"
|
2018-07-20 01:25:30 +03:00
|
|
|
)
|
|
|
|
|
2018-07-29 19:58:42 +03:00
|
|
|
func NewHandler(repo repository.Repo) http.Handler {
|
|
|
|
backend := resolvers.NewRootResolver()
|
2018-07-25 22:26:25 +03:00
|
|
|
|
2018-07-29 19:58:42 +03:00
|
|
|
backend.RegisterDefaultRepository(repo)
|
2018-07-25 22:26:25 +03:00
|
|
|
|
2018-07-29 19:58:42 +03:00
|
|
|
return handler.GraphQL(resolvers.NewExecutableSchema(backend))
|
2018-07-19 15:15:50 +03:00
|
|
|
}
|