Created
September 21, 2016 18:12
-
-
Save Akryum/2fec1d9ae632b932918f6a185d5be154 to your computer and use it in GitHub Desktop.
vue-apollo configuration and app startup
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
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