@ryanchenkie
query {
allCourses {
id
}
}
{
"data": {
"allCourses": [
{
"id": "1"
},
{
"id": "2"
},
{
"id": "3"
}
]
}
}
query {
allCourses {
id
name
description
}
}
{
"data": {
"allCourses": [
{
"id": "1",
"name": "Functional JavaScript",
"description": "Because FUN"
},
{
"id": "2",
"name": "Intro to HTML",
"description": "Start somewhere"
},
{
"id": "3",
"name": "Intro to Machine Learning",
"description": "Learn machines"
}
]
}
}
query {
Course(id: 1) {
id
name
description
}
}
{
"data": {
"Course": {
"id": "1",
"name": "Functional JavaScript",
"description": "Because FUN"
}
}
}
query {
firstStudent: Student(id: 4) {
id
firstName
lastName
}
lastStudent: Student(id: 5) {
id
firstName
lastName
}
}
{
"data": {
"firstStudent": {
"id": "4",
"firstName": "John",
"lastName": "Doe"
},
"lastStudent": {
"id": "5",
"firstName": "Jane",
"lastName": "Smith"
}
}
}
query {
Student(id: 4) {
id
firstName
lastName
Courses {
...course
}
}
}
fragment course on Course {
id
name
level
}
{
"data": {
"Student": {
"id": "4",
"firstName": "John",
"lastName": "Doe",
"Courses": [
{
"id": "1",
"name": "Functional JavaScript",
"level": "200"
},
{
"id": "2",
"name": "Intro to HTML",
"level": "100"
}
]
}
}
}
github.com/marmelab/json-graphql-server
bit.ly/rethinking-data-graphql
@ryanchenkie