Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to GraphQL

Introduction to GraphQL

Introduction to GraphQL by Anil Gurindapalli at XAMPR's workshop.

Anil Kumar Gurindapalli

February 19, 2019
Tweet

More Decks by Anil Kumar Gurindapalli

Other Decks in Technology

Transcript

  1. XAMPR • Declarative and data fetching Query Language. • Became

    Open Source in 2015 • Used in Production of Facebook Mobile Apps for data fetching. • Get Data from Server to client • Is used by companies like Netflix, Coursera, Pinterest, GitHub, etc. 3
  2. XAMPR • Over fetching and Under fetching • Multiple round

    trips • Performance Suffers THE PROBLEM 5
  3. XAMPR Instead of having multiple “dumb” endpoints, have a single

    “smart” endpoint that can take in complex queries, and then massage the data output into whatever shape the client requires. SOLUTION 7
  4. THREE MAIN CHARACTERISTICS 1. It lets the client specify exactly

    what data it needs. 2. It makes it easier to aggregate data from multiple sources. 3. It uses a type system to describe data. XAMPR 9
  5. BENEFITS • Avoid Multiple REST Calls (Performance) • Client Determines

    shape and size (Flexibility) • Is Backward compatible and version-free (Evolution) • Can wrap around Existing API • Is language agnostic. • Immediate Productive (Developer Productivity) XAMPR 10
  6. XAMPR 1. Query To GET the data 2. Mutation To

    POST the data OPERATION TYPES OF QUERY 17 query mutation
  7. XAMPR Every Query goes through three phases 1. Parse 2.

    Validated 3. Executed 25 Parse Validate Execute
  8. VALIDATE   The AST is validated against the schema. Checks

    for correct query syntax and if the fields exist. XAMPR 27
  9. EXECUTE  The runtime walks through the AST, starting from the

    root of the tree, invokes resolvers, collects up results, and emits JSON. XAMPR 28