Curl a GraphQL API

Programming GraphQL CommandLine

curl -0 -v -X POST \ -H 'Content-Type: application/json' \ -d @- << EOF { "query": "query { someQuery (someArg: false) { name } }" } EOF curl will probably complain about the -X POST being inferred, but it shouldn’t harm anything. It can be left out.


Programming GraphQL

“colocation” is a pattern wherein you keep the query/mutation as close to the consuming component as possible. In many instances, it’s in the exact file. This is in contrast with the DRY approach, which would beg the author to push queries/mutations higher up and imported into whichever file needs it.