Testing the GraphQL server implementation.
Run yarn dev
and open localhost:4000
Query all records
query {
highlights {
id
content
title
author
}
}
or just some fields
query {
highlights {
title
author
}
}
Result:
{
"data": {
"highlights": [
{
"title": "Dharma Bums",
"author": "Jack Kerouac"
},
{
"title": "Arbitrary Stupid Goal",
"author": "Tamara Shopsin"
}
]
}
}
query {
highlight(id: "1") {
content
}
}
Result:
{
"data": {
"highlight": {
"content": "One day I will find the right words, and they will be simple."
}
}
}
mutation {
newHighlight(author: "Adam Scott" title: "JS Everywhere" content: "GraphQL is awesome") {
id
author
title
content
}
}
Result:
{
"data": {
"newHighlight": {
"id": "3",
"author": "Adam Scott",
"title": "JS Everywhere",
"content": "GraphQL is awesome"
}
}
}
mutation {
deleteHighlight(id: "3") {
id
}
}
Result:
{
"data": {
"deleteHighlight": {
"id": "3"
}
}
}