Files
apollo/docs/guide/multiple-clients.md
T
Guillaume Chau 56f317af07 docs: big update
2018-06-18 18:11:46 +02:00

32 lines
668 B
Markdown

# Multiple clients
You can specify multiple apollo clients if your app needs to connect to different GraphQL endpoints:
```js
const apolloProvider = new VueApollo({
clients: {
a: apolloClient,
b: otherApolloClient,
},
defaultClient: apolloClient,
})
```
In the component `apollo` option, you can define the client for all the queries, subscriptions and mutations with `$client` (only for this component):
```js
export default {
apollo: {
$client: 'b',
},
}
```
You can also specify the client in individual queries, subscriptions and mutations with the `client` property in the options:
```js
tags: {
query: gql`...`,
client: 'b',
}
```