Skip to content

Instantly share code, notes, and snippets.

@jakedohm
Created May 2, 2019 18:54
Show Gist options
  • Save jakedohm/ede5eb3befa5c0f184a37df8b0cda1c9 to your computer and use it in GitHub Desktop.
Save jakedohm/ede5eb3befa5c0f184a37df8b0cda1c9 to your computer and use it in GitHub Desktop.
const { setContext } = require('apollo-link-context')
const { HttpLink } = require('apollo-link-http')
const {
introspectSchema,
makeRemoteExecutableSchema,
} = require('graphql-tools')
const fetch = require('node-fetch')
const http = new HttpLink({
uri: 'http://example.com/api',
fetch,
})
const link = setContext((request, previousContext) => ({
headers: {
Authorization: `Bearer `,
},
})).concat(http)
const schema = await introspectSchema(link)
const executableSchema = await makeRemoteExecutableSchema({
schema: schema,
link,
})
const fullSchema = executableSchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment