Skip to content

Instantly share code, notes, and snippets.

@Akryum
Created September 21, 2016 18:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Akryum/2fec1d9ae632b932918f6a185d5be154 to your computer and use it in GitHub Desktop.
vue-apollo configuration and app startup
import Vue from 'vue';
import App from './App.vue';
import ApolloClient, { createNetworkInterface, addTypename } from 'apollo-client';
import VueApollo from 'vue-apollo';
// Create the apollo client
const apolloClient = new ApolloClient({
networkInterface: createNetworkInterface({
uri: 'http://localhost:8080/graphql',
transportBatching: true,
}),
queryTransformer: addTypename,
dataIdFromObject: r => r.id,
});
// Install the vue plugin
// With the apollo client instance
Vue.use(VueApollo, {
apolloClient,
});
// Start the Vue app
new Vue({
el: '#app',
render: h => h(App)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment