Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote schema, node-fetch example, unexpeced colon #1127

Closed
mikaelkundert opened this issue May 14, 2019 · 1 comment
Closed

Remote schema, node-fetch example, unexpeced colon #1127

mikaelkundert opened this issue May 14, 2019 · 1 comment

Comments

@mikaelkundert
Copy link

On Remote schemas docs we have an example for using node-fetch:

import fetch from 'node-fetch';
import { print } from 'graphql':

const fetcher = async ({ query: queryDocument, variables, operationName, context }) => {
  const query = print(queryDocument);
  const fetchResult = await fetch('http://api.githunt.com/graphql', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ query, variables, operationName })
  });
  return fetchResult.json();
};

export default async () => {
  const schema = makeRemoteExecutableSchema({
    schema: await introspectSchema(fetcher),
    fetcher,
  });
  return schema
}

Line 2 ends with : and doesn't work.

mikaelkundert added a commit to mikaelkundert/graphql-tools that referenced this issue May 14, 2019
mikaelkundert added a commit to mikaelkundert/graphql-tools that referenced this issue May 14, 2019
@yaacovCR
Copy link
Collaborator

Folding into #1316

@yaacovCR yaacovCR mentioned this issue Mar 29, 2020
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants