image/svg+xml
students
REST
/v2/users
{
users {
id
name
reputation
}
}
1 *
* 1
_____
*
*
* 1
type College {
id: ID!
name: String
location: String
rating: Float
}
type
Student
{
id: ID!
firstName: String
lastName: String
fullName: String
email: String
password: String
college
: College
}
type
Query
{
test: String
students: [Student]
studentById(id: ID!): Student
}
Activités :
1. Ouvrir le
playground
1. essayer
query
{
students
}
2. essayer
query
{
college
}
et voir l'erreur
const
Query
= {
test: () => 'bonjour',
students: () => db.students.list(),
studentById:
(root,
args
)
=> db.students.get(
args.id
)
};
const
Student
= {
fullName
: (root, args)
=> root.firstName + ":" + root.lastName,
college
: (root)
=>
db.colleges.get(root.collegeId)
}
Query
test
studentById
MPD
Student
fullName
college
👆
👆
⚠️
SQL :
SELECT
Col3
FROM MaTable
2012
2015
open
source
R
Ahmed DIKOUK, Ka Lok TAM
https://vincenttam.gitlab.io/presentation-de-graphql
1
1ere page
Historique
Comment marche GraphQL ?
Un aller-retour en GraphQL
REST vs GraphQL
REST vs GraphQL (Overfetching)
Pikachu
Rappel resolveur
Pourquoi schema ?
schema exemplaire
resolveur exemple
resolveur root
Schema et Query
Arguments
Alias
Fragment
Variable
Variable avec diapo 2
Interface
opération de mutation
opération souscription