How to use the graphql-config.GraphQLEndpoint function in graphql-config

To help you get started, we’ve selected a few graphql-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Urigo / graphql-cli / src / cmds / get-schema.ts View on Github external
async function downloadFromEndpointUrl(argv: Arguments) {
  const endpointHeaders = {}
  if (argv.header) {
    const headers = Array.isArray(argv.header) ? argv.header : [argv.header]
    Object.assign(
      endpointHeaders,
      ...headers.map(h => ({ [h.split('=')[0]]: h.split('=')[1] })),
    )
  }

  const endpoint = new GraphQLEndpoint({
    url: argv.endpoint,
    headers: endpointHeaders,
  })

  await updateSingleProjectEndpoint(undefined, endpoint, 'unnamed', argv)
}