GraphQL - Serving over HTTP
Contents
GraphQL - Serving over HTTP
https://graphql.org/learn/serving-over-http/
HTTP is the most common choice for client-server protocol when using GraphQL because of its ubiquity. Here are some guidelines for setting up a GraphQL server to operate over HTTP.
CURL Call:
$ curl -d ‘{“query”:"{people{ surname }}"}’ -H “Content-Type: application/json” -X POST http://localhost:8080/graphql
Reponse:
{“data”:{“people”:[{“surname”:“Fahey”},{“surname”:“Kuhn”},{“surname”:“Marks”},{“surname”:“Runolfsdottir”}]}}
Source: commit 5b74c13 in My-Notes.