から非アポロGraphQLサーバーから照会することができません:私は、コードの実行中にエラーを得続けるしかし私は以下のような非アポロGraphQLサーバーにアポロクライアントを使用して要求を作ってみましたアポロクライアント
import ApolloClient, { createNetworkInterface } from 'apollo-client';
// Register gql globally
import { registerGqlTag } from 'apollo-client/gql';
registerGqlTag();
const networkInterface = createNetworkInterface(' http://localhost:8080/graphql', {
headers: {
'Content-type': "application/json"
}
});
var client = new ApolloClient({
networkInterface
});
client.query({
query: gql`
query getTodo($todoId: Int!) {
node(id: $todoId) {
... on Todo {
id
text
}
}
}
`,
variables: {
todoId: "todo:100000",
},
forceFetch: false,
}).then((graphQLResult) => {
var errors = graphQLResult.errors;
var data = graphQLResult.data;
if (data) {
console.log('got data', data);
}
if (errors) {
console.log('got some GraphQL execution errors', errors);
}
}).catch((error) => {
console.log('there was an error sending the query', error);
});
: there was an error sending the query [ReferenceError: fetch is not defined]
私はそれに関連する問題を検索しようとしますが、ドキュメントは本当に役に立ちません。
ありがとうございます。
私はこの問題に関連アポロメンバーからの応答を得た、https://github.com/apollostack/apollo-client/issues/177 –