$ docker-compose up -d app
or
$ npm install
$ npm run build
$ npm run start
(docker) http://0.0.0.0:3000/graphql
(local) http://localhost:3000/graphql
-- Query_1
{
cats {
id,
name,
age
}
}
-- Result_1
{
"data": {
"cats": [
{
"id": 1,
"name": "mike",
"age": 5
},
{
"id": 2,
"name": "kuro",
"age": 3
},
{
"id": 3,
"name": "maro",
"age": 8
}
]
}
}
-- Query_2
{
cat(id: 1) {
id,
name,
age
}
}
-- Result_2
{
"data": {
"cat": {
"id": 1,
"name": "mike",
"age": 5
}
}
}
$ curl -X POST -H "Content-Type:application/json" -d '{ "query": "{ cat(id: 1) { id,name,age } }" }' http://0.0.0.0:3000/graphql