setup

bin/setup
bin/rails db:seed

get user

N+1 Problem

get only book

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books0 { id name purchaseOn }}", "operationName": "BooksQuery"}'

get book and user

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books0 { id name purchaseOn user { id name hasBook purchaseBooks{ id name purchaseOn } }}}", "operationName": "BooksQuery"}'

Preload Model

get only book

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books3 { id name purchaseOn }}", "operationName": "BooksQuery"}'

get book and user

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books3 { id name purchaseOn user { id name hasBook purchaseBooks{ id name purchaseOn } }}}", "operationName": "BooksQuery"}'

Graphql Ruby

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books1 { id name purchaseOn user { id name hasBook purchaseBooks{ id name purchaseOn } }}}", "operationName": "BooksQuery"}'

Graphql Batch

curl -s "http://localhost:3000/graphql" \
--json '{"query": "query BooksQuery{ books2 { id name purchaseOn user { id name hasBook purchaseBooks{ id name purchaseOn } }}}", "operationName": "BooksQuery"}'