Guillaume Chau
Vue.js Core Team
MongoDB
MySQL
Oracle
ERP
CRM
Vue
Angular
React
Micro-services
Redis
Android
iOS
Legacy custom apps
AWS
JavaScript
Java
C#
Frontend Team
Backend Team
DataBase Team
Other Service Team
type Message {
id: ID!
content: String
user: User
date: Int
}
type User {
id: ID!
name: String
email: String
avatarUrl: String
}
type Query {
messages: [Message]
}
{
messages {
id
content
user {
id
name
}
}
}
{
"data": {
"messages": [
{
"id": "0",
"content": "Are you enjoying the conference?",
"user": {
"id": "0",
"name": "Anne"
}
},
{
"id": "1",
"content": "Absolutely!",
"user": {
"id": "1",
"name": "Yoan"
}
}
]
}
}
Query
Mutation
Subscription (Web socket)
.gql
Observable
query
Normalized Cache
import Vue from 'vue'
import VueApollo from 'vue-apollo'
Vue.use(VueApollo)
const provider = new VueApollo({
defaultClient: apolloClient
})
new Vue({
provide: provider.provide(),
// ...
})
query {
user (id: $id) {
id
name
email
avatar
}
}
query {
user (id: $id) {
id
name
email
avatar
}
}
<ApolloQuery
:query="require('../graphql/HelloWorld.gql')"
:variables="{ name }"
>
<template slot-scope="{ result: { loading, error, data } }">
<!-- Loading -->
<div v-if="loading" class="loading apollo">Loading...</div>
<!-- Error -->
<div v-else-if="error" class="error apollo">An error occured</div>
<!-- Result -->
<div v-else-if="data" class="result apollo">{{ data.hello }}</div>
<!-- No result -->
<div v-else class="no-result apollo">No result :(</div>
</template>
</ApolloQuery>
<ApolloMutation
:mutation="require('@/graphql/userLogin.gql')"
:variables="{
email,
password,
}"
@done="onDone"
>
<template slot-scope="{ mutate, loading, error }">
<!-- Form -->
<input v-model="email" type="email">
<input v-model="password" type="password">
<button :disabled="loading" @click="mutate()">Click me</button>
<!-- Error -->
<p v-if="error">An error occured: {{ error }}</p>
</template>
</ApolloMutation>
$ vue add apollo
Monitoring with history
Performance tracing
Errors tracking
Schema inspect
Caching
Automatic persisted queries
1M requests per month free
Guillaume Chau
@Akryum
github.com/Akryum