GraphQL

The GraphQL connector allows you to merge remote GraphQL APIs with your existing project API using the Edge Gateway.

  • name (required) — The unique name for connector
  • namespace (optional, true by default) — Enable or disable the namespace
  • url — The URL used to execute requests and introspection
  • headers (optional) — The static or forwarded headers sent with requests
import { config, connector, g } from '@grafbase/sdk'

const contentful = connector.GraphQL('Contentful', {
  url: g.env('CONTENTFUL_API_URL'),
  headers: headers => {
    headers.set('Authorization', `Bearer ${g.env('CONTENTFUL_API_KEY')}`)
  },
})

g.datasource(contentful)
Was this page helpful?