forked from graphql-java/graphql-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage-info.java
More file actions
49 lines (49 loc) · 1.31 KB
/
Copy pathpackage-info.java
File metadata and controls
49 lines (49 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* The purpose of this code is to show an example of serving a graphql query over HTTP
*
* More info can be found here : http://graphql.org/learn/serving-over-http/
*
* There are more concerns in a fully fledged application such as your approach to permissions
* and authentication and so on that are not shown here.
*
* The backing data is the "star wars" example schema. And fairly complex example query is as follows :
*
* <pre>
* {@code
* {
* luke: human(id: "1000") {
* ...HumanFragment
* }
* leia: human(id: "1003") {
* ...HumanFragment
* }
* }
*
* fragment HumanFragment on Human {
* name
* homePlanet
* friends {
* name
* __typename
* }
* }
*
* }
* </pre>
*
* This also has @defer support which sends back HTTP multipart requests. Since tools like graphiql dont understand http multipart
* then you might use a tool like curl to see results
*
* <pre>
* {@code
* curl \
* -X POST \
* -H "Content-Type: application/json" \
* --data '{ "query": "{ hero { name friends @defer { name } } } "}' \
* http://localhost:8080/graphql
* }
* </pre>
*
* See https://www.apollographql.com/docs/react/features/defer-support.html for some more details on @defer
*/
package example.http;