Learning GraphQL - Declarative Data Fetching For Modern Web Apps

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Eve Porcello, Alex Banks
Edition: 1
Publisher: O’Reilly Media
Year: 2018

Language: English
Pages: 299
Tags: graphql, javascript

Preface......Page 5
Acknowledgments......Page 6
Conventions Used in This Book......Page 7
Using Code Examples......Page 8
O’Reilly Safari......Page 9
How to Contact Us......Page 10
1. Welcome to GraphQL......Page 11
What Is GraphQL?......Page 12
The GraphQL Specification......Page 15
Design Principles of GraphQL......Page 16
Origins of GraphQL......Page 17
History of Data Transport......Page 18
Remote Procedure Call......Page 19
Simple Object Access Protocol......Page 20
REST......Page 21
REST Drawbacks......Page 23
Overfetching......Page 24
Underfetching......Page 26
Managing REST Endpoints......Page 29
GraphQL in the Real World......Page 30
GraphQL Clients......Page 31
2. Graph Theory......Page 33
Graph Theory Vocabulary......Page 38
History of Graph Theory......Page 43
Trees are Graphs......Page 48
Graphs in the Real World......Page 53
3. The GraphQL Query Language......Page 57
GraphQL API Tools......Page 60
GraphiQL......Page 61
GraphQL Playground......Page 66
Public GraphQL APIs......Page 69
The GraphQL Query......Page 70
Edges and Connections......Page 75
Fragments......Page 77
Mutations......Page 85
Using Query Variables......Page 87
Subscriptions......Page 88
Introspection......Page 90
Abstract Syntax Trees......Page 92
4. Designing a Schema......Page 94
Defining Types......Page 95
Types......Page 96
Scalar Types......Page 98
Enums......Page 99
Connections and Lists......Page 100
One-to-One Connections......Page 101
One-to-Many Connections......Page 103
Many-to-Many Connections......Page 106
Lists of Different Types......Page 109
Arguments......Page 113
Filtering Data......Page 115
Mutations......Page 119
Input Types......Page 122
Return Types......Page 126
Subscriptions......Page 128
Schema Documentation......Page 130
5. Creating a GraphQL API......Page 133
Project Setup......Page 134
Resolvers......Page 135
Root Resolvers......Page 138
Type Resolvers......Page 141
Using Inputs and Enums......Page 145
Edges and Connections......Page 148
Custom Scalars......Page 155
apollo-server-express......Page 161
Context......Page 165
Installing Mongo......Page 166
Adding Database to Context......Page 168
GitHub Authorization......Page 171
Setting Up GitHub OAuth......Page 172
The Authorization Process......Page 176
githubAuth Mutation......Page 178
Authenticating Users......Page 183
Conclusion......Page 191
6. GraphQL Clients......Page 192
Using a GraphQL API......Page 193
fetch Requests......Page 194
graphql-request......Page 196
Apollo Client......Page 200
Apollo Client with React......Page 201
Project Setup......Page 202
Configure Apollo Client......Page 203
The Query Component......Page 207
The Mutation Component......Page 212
Authorization......Page 214
Authorizing the User......Page 216
Identifying the User......Page 221
Working with the Cache......Page 224
Fetch Policies......Page 225
Persisting The Cache......Page 227
Updating the Cache......Page 229
7. GraphQL in the Real World......Page 234
Subscriptions......Page 235
Working with Subscriptions......Page 236
Consuming Subscriptions......Page 243
Uploading Files......Page 249
Handling Uploads on the Server......Page 250
Posting a New Photo with Apollo Client......Page 253
Security......Page 261
Request Timeouts......Page 262
Data Limitations......Page 263
Limiting Query Depth......Page 264
Limiting Query Complexity......Page 267
Apollo Engine......Page 270
Taking the Next Steps......Page 272
Incremental Migration......Page 273
Schema-First Development......Page 275
GraphQL Events......Page 278
Community......Page 279
Community Slack Channels......Page 280
Index......Page 281