如何检查ApolloClient是否与服务器连接

时间:2019-01-07 11:50:13

标签: reactjs apollo react-apollo apollo-client

我已经使用reactjs设置了ApolloClient。我已经在URL http://localhost:3044/graphql上创建了服务器。现在,我需要测试它是否连接到该后端URL。我该怎么办?

import  ApolloClient  from 'apollo-boost';
import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';

const BASE_URL = 'http://localhost:3055/graphql';
const cache = new InMemoryCache();
const httpLink = new HttpLink({
  uri: BASE_URL
});


export const client = new ApolloClient({
    uri:BASE_URL
  });

ReactDOM.render(
    <ApolloProvider client={client}>
        <App />
    </ApolloProvider>
        , document.getElementById('root'));

谢谢!

0 个答案:

没有答案