Last active
September 13, 2022 13:03
-
-
Save Sky-bits/7e49b916b31b754738f27d60c483c059 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for your interest in helping make Apollo Client better! | |
Feature requests and non-bug related discussions are no longer managed in this repo. Feature requests should be opened in https://github.com/apollographql/apollo-feature-requests. | |
i can find into the Office Doc how use more then one endpoint | |
here is my solution on Apollo react client | |
` const firstLink = new HttpLink({ | |
uri: 'graphql-postgre', | |
//headers: yourHeadersHere, | |
// other link options... | |
}); | |
const secondLink = new HttpLink({ | |
uri: 'http://localhost:3000/graphqli', | |
}); | |
const client = new ApolloClient({ | |
link: ApolloLink.split( | |
(o) => o.getContext().clientName === 'firstlink', | |
firstLink, | |
ApolloLink.split((o) => o.getContext().clientName === 'secondlink ', | |
secondLink ) | |
), // by default -> postgre) | |
cache: new InMemoryCache(), | |
fecthOptions: { | |
mode: 'no-cors', | |
}, | |
shouldBatch: true, | |
});` | |
query `const { loading, error, data } = useQuery(MyQueries, { context: {clientName: 'secondlink'}}); | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment