Run the server:
make run
Navigate to https://localhost:4000 you can see GraphiQL playground and query the graphql server.
xdg-open http://localhost:4000/
Execute createTodo mutation
make create-todo
mutation createTodo {
createTodo(text: "todo1") {
id
text
done
}
}
Expected JSON result:
{
"data": {
"createTodo": {
"id": 1,
"text": "todo1",
"done": false
}
}
}
Execute getTodo query
make get-todo
query getTodo {
getTodo(todoId: 1) {
id
text
done
}
}
Expected JSON result:
{
"data": {
"getTodo": {
"id": 1,
"text": "todo1",
"done": false
}
}
}
Execute getTodos query
make get-todos
query getTodos {
getTodos {
id
text
done
}
}
Expected JSON result:
{
"data": {
"getTodos": [
{
"id": 1,
"text": "todo1",
"done": false
},
{
"id": 2,
"text": "todo2",
"done": false
},
{
"id": 3,
"text": "todo3",
"done": false
},
{
"id": 4,
"text": "todo4",
"done": false
},
{
"id": 5,
"text": "todo5",
"done": false
}
]
}
}
Execute updateTodo mutation
make update-todo
mutation updateTodo {
updateTodo(input: {id: 1, text: "todo", done: true}) {
id
text
done
}
}
Expected JSON result:
{
"data": {
"updateTodo": {
"id": 1,
"text": "todo",
"done": true
}
}
}
Execute deleteTodo mutation
make delete-todo
mutation deleteTodo {
deleteTodo(todoId: 1) {
id
text
done
}
}
Expected JSON result:
{
"data": {
"deleteTodo": {
"id": 0,
"text": "",
"done": false
}
}
}