diff --git a/pkg/api/api.go b/pkg/api/api.go index 016ff613f..4e2d06d27 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -92,7 +92,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { router.Use(cors.Handler(corsOpts)) - router.Mount("/console/v1", console_v1.NewMux()) + router.Mount("/console/v1", console_v1.NewMux(s.cfg.Probo)) router.ServeHTTP(w, r) } diff --git a/pkg/api/console/v1/resolver.go b/pkg/api/console/v1/resolver.go index 3c9599b13..8e24127a0 100644 --- a/pkg/api/console/v1/resolver.go +++ b/pkg/api/console/v1/resolver.go @@ -34,18 +34,20 @@ type ( } ) -func NewMux() *chi.Mux { +func NewMux(probo *probo.Service) *chi.Mux { r := chi.NewMux() r.Get("/", playground.Handler("GraphQL", "/console/v1/query")) - r.Post("/query", graphql()) + r.Post("/query", graphql(probo)) return r } -func graphql() http.HandlerFunc { +func graphql(probo *probo.Service) http.HandlerFunc { es := schema.NewExecutableSchema( schema.Config{ - Resolvers: &Resolver{}, + Resolvers: &Resolver{ + svc: probo, + }, }, ) srv := handler.New(es)