@@ -75,11 +75,20 @@ var index = React.createClass({
75
75
</ section >
76
76
77
77
< section className = "point1" >
78
+ < div className = "prose" >
79
+ < h2 > Ask for what you need,< br /> get exactly that</ h2 >
80
+ { /*[Illustration: just a simple query and response?]*/ }
81
+ < p >
82
+ Send a GraphQL query to your API and get exactly what you need,
83
+ nothing more and nothing less. GraphQL queries always return
84
+ predictable results. Apps using GraphQL are fast and stable because
85
+ they control the data they get, not the server.</ p >
86
+ </ div >
78
87
< div className = "faux-graphiql" aria-hidden >
79
88
< div className = "query" >
80
89
< pre className = "prism" >
81
90
{ '{' }
82
- { '\n me {' }
91
+ { '\n hero {' }
83
92
{ '\n name' }
84
93
{ '\n eyeColor\n hairColor' . split ( '' ) . map ( ( c , i ) =>
85
94
< span key = { i } id = { 'ch' + i } className = "ch" > { c === '\n' ? < br /> : c } </ span > ) }
@@ -92,7 +101,7 @@ var index = React.createClass({
92
101
< div id = "r1" >
93
102
< Prism >
94
103
{ `{
95
- "me ": {
104
+ "hero ": {
96
105
"name": "Luke Skywalker"
97
106
}
98
107
}` }
@@ -101,7 +110,7 @@ var index = React.createClass({
101
110
< div id = "r2" >
102
111
< Prism >
103
112
{ `{
104
- "me ": {
113
+ "hero ": {
105
114
"name": "Luke Skywalker",
106
115
"eyeColor": "blue"
107
116
}
@@ -111,7 +120,7 @@ var index = React.createClass({
111
120
< div id = "r3" >
112
121
< Prism >
113
122
{ `{
114
- "me ": {
123
+ "hero ": {
115
124
"name": "Luke Skywalker",
116
125
"eyeColor": "blue",
117
126
"hairColor": "blond"
@@ -121,7 +130,7 @@ var index = React.createClass({
121
130
</ div >
122
131
</ div >
123
132
</ div >
124
- < script dangerouslySetInnerHTML = { { __html : `
133
+ < script dangerouslySetInnerHTML = { { __html : `(function(){
125
134
var i = 0;
126
135
var forward = true;
127
136
setTimeout(type, 2000);
@@ -157,36 +166,27 @@ var index = React.createClass({
157
166
document.getElementById('r2').style.display = num === 2 ? 'block' : 'none';
158
167
document.getElementById('r3').style.display = num === 3 ? 'block' : 'none';
159
168
}
160
- ` } } />
161
- < div className = "prose" >
162
- < h2 > Ask for what you need,< br /> get exactly that</ h2 >
163
- { /*[Illustration: just a simple query and response?]*/ }
164
- < p >
165
- Send a GraphQL query to your API and get exactly what you need,
166
- nothing more and nothing less. GraphQL queries always return
167
- predictable results. Apps using GraphQL are fast and stable because
168
- they control the data they get, not the server.</ p >
169
- </ div >
169
+ })()` } } />
170
170
</ section >
171
171
172
172
< div className = "grayWash" >
173
173
< section className = "point2" >
174
174
< div className = "prose" >
175
- < h2 > Get many resources< br /> in a single request</ h2 >
176
- { /*Illustration: a query 2 or 3 levels deep]*/ }
177
- < p >
178
- GraphQL queries access not just the properties of one resource but
179
- also smoothly follow references between them. While typical APIs
180
- require loading from multiple URLs, GraphQL APIs get all the data
181
- your app needs in a single request. Apps using GraphQL are quick
182
- even on slow mobile network connections.</ p >
175
+ < h2 > Get many resources< br /> in a single request</ h2 >
176
+ { /*Illustration: a query 2 or 3 levels deep]*/ }
177
+ < p >
178
+ GraphQL queries access not just the properties of one resource
179
+ but also smoothly follow references between them. While typical
180
+ REST APIs require loading from multiple URLs, GraphQL APIs get
181
+ all the data your app needs in a single request. Apps using
182
+ GraphQL are quick even on slow mobile network connections.</ p >
183
183
</ div >
184
184
< div className = "app-to-server" aria-hidden >
185
185
< img src = "/img/phone.svg" width = "496" height = "440" />
186
186
< div className = "query" >
187
187
< Prism >
188
188
{ `{
189
- me {
189
+ hero {
190
190
name
191
191
friends {
192
192
name
@@ -198,7 +198,7 @@ var index = React.createClass({
198
198
< div className = "response" >
199
199
< Prism >
200
200
{ `{
201
- "me ": {
201
+ "hero ": {
202
202
"name": "Luke Skywalker",
203
203
"friends": [
204
204
{ "name": "Obi-Wan Kenobi" },
@@ -217,29 +217,98 @@ var index = React.createClass({
217
217
218
218
< section className = "point3" >
219
219
< div className = "prose" >
220
- < h2 > Describe what’s possible< br /> with a type system</ h2 >
221
- { /*Illustration of a type IDL following a query by line]*/ }
222
- { /*Under: a server <-> client (Capabilities, Requirements)]?*/ }
223
- < p >
224
- GraphQL APIs are organized in terms of types and fields,
225
- not endpoints. Access the full capabilities of your data from a
226
- single endpoint. GraphQL uses types to ensure Apps only ask for
227
- what’s possible and provide clear and helpful errors. Apps can
228
- use types to avoid writing manual parsing and model code.</ p >
220
+ < h2 > Describe what’s possible< br /> with a type system</ h2 >
221
+ { /*Illustration of a type IDL following a query by line]*/ }
222
+ { /*Under: a server <-> client (Capabilities, Requirements)]?*/ }
223
+ < p >
224
+ GraphQL APIs are organized in terms of types and fields,
225
+ not endpoints. Access the full capabilities of your data from a
226
+ single endpoint. GraphQL uses types to ensure Apps only ask for
227
+ what’s possible and provide clear and helpful errors. Apps can
228
+ use types to avoid writing manual parsing code.</ p >
229
229
</ div >
230
+ < div className = "strong-typed-query" aria-hidden >
231
+ < div className = "query" >
232
+ < div id = "query-highlight" className = "highlight" />
233
+ < Prism >
234
+ { `{
235
+ hero {
236
+ name
237
+ friends {
238
+ name
239
+ homeWorld {
240
+ name
241
+ climate
242
+ }
243
+ species {
244
+ name
245
+ lifespan
246
+ origin {
247
+ name
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }` }
253
+ </ Prism >
254
+ </ div >
255
+ < div className = "type-system" >
256
+ < div id = "type-highlight" className = "highlight" />
257
+ < Prism >
258
+ { `type Query {
259
+ hero: Character
260
+ }
261
+
262
+ type Character {
263
+ name: String
264
+ friends: [Character]
265
+ homeWorld: Planet
266
+ species: Species
267
+ }
268
+
269
+ type Planet {
270
+ name: String
271
+ climate: String
272
+ }
273
+
274
+ type Species {
275
+ name: String
276
+ lifespan: Int
277
+ origin: Planet
278
+ }` }
279
+ </ Prism >
280
+ </ div >
281
+ </ div >
282
+ < script dangerouslySetInnerHTML = { { __html : `(function(){
283
+ var typeHighlight = document.getElementById('type-highlight');
284
+ var queryHighlight = document.getElementById('query-highlight');
285
+ var line = 0;
286
+ var typeLines = [2,6,7,6,8,13,14, 9,18,19,20,13];
287
+ var queryLines = [2,3,4,5,6, 7, 8,10,11,12,13,14];
288
+ highlightLine();
289
+ function highlightLine() {
290
+ typeHighlight.style.top = (17 * typeLines[line] - 9) + 'px';
291
+ queryHighlight.style.top = (17 * queryLines[line] - 9) + 'px';
292
+ line = (line + 1) % typeLines.length;
293
+ setTimeout(highlightLine, 800 + Math.random() * 200);
294
+ }
295
+ })()` } } />
230
296
</ section >
231
297
232
- < section >
233
- < h2 > Move faster with powerful developer tools</ h2 >
234
- { /*Illustration of GraphiQL validation error and typeahead, animated?]*/ }
235
- < p >
236
- Know exactly what data you can request from your API without leaving
237
- your editor, highlight potential issues before sending a query, and
238
- take advantage of improved code intelligence. GraphQL introspection
239
- makes it easy to build new powerful tools by leveraging a GraphQL
240
- API’s type system. You can even automatically generate your
241
- API documentation.</ p >
298
+ < div className = "darkWash" >
299
+ < section className = "point4" >
300
+ < div className = "prose" >
301
+ < h2 > Move faster with< br /> powerful developer tools</ h2 >
302
+ { /*Illustration of GraphiQL validation error and typeahead, animated?]*/ }
303
+ < p >
304
+ Know exactly what data you can request from your API without
305
+ leaving your editor, highlight potential issues before sending a
306
+ query, and take advantage of improved code intelligence. GraphQL
307
+ makes it easy to build powerful tools by leveraging your
308
+ API’s type system. You can even auto-generate your docs.</ p >
309
+ </ div >
242
310
</ section >
311
+ </ div >
243
312
244
313
< section >
245
314
< h2 > Evolve your API without versions</ h2 >
0 commit comments