Exemple d'utilisation de GraphQL avec Node.js et Express
npm install express graphql express-graphql
{
posts {
title
description
author {
name
age
}
}
}
{
"data": {
"posts": [
{
"title": "First post",
"description": "Content of the first post",
"author": {
"name": "Flavio",
"age": 36
}
},
{
"title": "Second post",
"description": "Content of the second post",
"author": {
"name": "Roger",
"age": 7
}
}
]
}
}
{
post(id: 0) {
title
description
}
}
{
"data": {
"post": {
"title": "First post",
"description": "Content of the first post"
}
}
}