VueJS + ApolloServer + ApolloClient


Hi there,

I’m lost, I need your help.

I’m new with Javascript, Vue, Apollo, client/server so please, talk to me with simple words haha :slight_smile:

I created an instance of VueJS thanks to vue-cli 3 (vue create…)

After that, I created a server.js file with apollo-server

const { ApolloServer } = require('apollo-server')

const server = new ApolloServer({
  modules: [

server.listen().then(({url}) => console.log(`server started at ${url}`))

I have a folder src, and in this folder I have a main.js file where I have ApolloClient linked to my ApolloServer

import Vue from 'vue'

import App from './App.vue'
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import VueApollo from 'vue-apollo'

const httpLink = new HttpLink({
   uri: 'http://localhost:4000' //my apolloserver

// Cache implementation
const cache = new InMemoryCache()

// Create the apollo client
const apolloClient = new ApolloClient({
   link: httpLink,
   connectToDevTools: true

const apolloProvider = new VueApollo({
   defaultClient: apolloClient

Vue.config.productionTip = false

new Vue({
   render: h => h(App)

Now, I would like to know, why on this tutorial:

They use express.js for builiding an apollo-server ?

What is the difference between express and apollo-server ?

The way I did is correct? Or I’m completly wrong ?