Skip to content

Instantly share code, notes, and snippets.

@sultaniman
Created September 21, 2018 07:26
Show Gist options
  • Select an option

  • Save sultaniman/e0dfa3aaa2bf95d4916fd6aa1fca10d8 to your computer and use it in GitHub Desktop.

Select an option

Save sultaniman/e0dfa3aaa2bf95d4916fd6aa1fca10d8 to your computer and use it in GitHub Desktop.
import Vue from 'vue'
import VueApollo from 'vue-apollo'
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { GRAPHQL_ENDPOINT } from './config'
const httpLink = new HttpLink({
// You should use an absolute URL here
uri: GRAPHQL_ENDPOINT
})
// Create the apollo client
export const apolloClient = new ApolloClient({
link: httpLink,
cache: new InMemoryCache(),
connectToDevTools: true
})
const apolloProvider = new VueApollo({
defaultClient: apolloClient
})
// Install the vue plugin
Vue.use(VueApollo)
export default apolloProvider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment