0%

Book Description

REST APIs are great, but when you have to make individual requests to 10, 20, 30, or more of them to render a page or screen, they can become a bit cumbersome for your frontend developers. Facebook solved these challenges by inventing and later open-sourcing GraphQL.

Rather than requesting data from each API individually, GraphQL allows frontend developers to build a query asking for all of the data that’s needed, no matter which REST APIs actually contain the data. The GraphQL server then retrieves the data and returns it to the frontend developer in a single JSON document. Having been pioneered by Facebook, Twitter, and many of the other Silicon Valley giants, GraphQL is just starting to be used in the commerce domain.

In this practical guide, you’ll learn:

  • The challenges of using REST APIs on their own
  • How GraphQL complements REST APIs
  • The origins of GraphQL and its ongoing governance model
  • About the GraphQL specification
  • How GraphQL clients and servers work

Table of Contents

  1. 1. Introducing GraphQL
    1. Commerce Requires More Than REST
      1. The Challenges of REST APIs
    2. What Is GraphQL?
      1. What Are Graphs?
      2. Commerce Graphs
      3. In the Beginning…
      4. Introducing GraphQL
      5. Benefits of GraphQL
      6. Drawbacks of GraphQL
    3. GraphQL Compared to REST APIs
    4. Final Thoughts
  2. 2. The GraphQL Specification
    1. Introducing the GraphQL Specification
      1. What’s in the GraphQL Specification?
      2. What’s Not in the GraphQL Specification?
    2. GraphQL Specification Governance and History
    3. Principles of the GraphQL Specification
      1. Evolvable
      2. Data Oriented
      3. Client Centric
      4. Strongly Typed
    4. GraphQL Terminology
      1. Types
      2. Fields
      3. Arguments
      4. Variables
      5. Fragments
      6. Interfaces
    5. GraphQL Operations
      1. Queries
      2. Mutations
      3. Subscriptions
      4. Introspection
    6. Final Thoughts
  3. 3. GraphQL Clients
    1. Low-Level Networking
    2. Batching
    3. Authentication
    4. Caching
    5. Language-Specific Bindings
    6. Frontend Framework Integration
    7. Final Thoughts
  4. 4. GraphQL Servers
    1. Building a Type Schema
    2. HTTP Request Handling
    3. Parsing Queries
    4. Validating
    5. Executing Queries
    6. Server Implementations
    7. Monitoring
    8. Testing
    9. Security
      1. Authentication
      2. Authorization
      3. Expensive Queries
    10. Merging Schemas
      1. Separate Files
      2. Schema Stitching
      3. Schema Federation
    11. Final Thoughts
3.236.145.110