Skip to content

Instantly share code, notes, and snippets.

@Akryum

Akryum/main.js

Created Sep 21, 2016
Embed
What would you like to do?
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