2

I have setup ApolloClient with reactjs. I have created server on url http://localhost:3044/graphql. Now I need to test whether it connected to that backend url or not. How do I do that?

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'));

Thank you!!!

Profer
  • 553
  • 8
  • 40
  • 81
  • Do want just test or are you looking for a way to monitor from your client if your backend still running? Just tests: https://www.apollographql.com/docs/react/recipes/testing.html Monitoring: I'm not pretty sure what's your case, but I think you can have an error handling to verify is there is something wrong with your backend. https://www.apollographql.com/docs/react/features/error-handling.html Hope this help. – masmerino Jan 07 '19 at 18:36
  • @masmerino Thank you for the reply. I will check and let you know +1 – Profer Jan 08 '19 at 05:55

0 Answers0