Agenda

What is GraphQL

GraphQL vs REST

Query, Mutation, Subscription 

Fragments

Setting up GraphQL with Apollo

GraphQL is a query language for your API

GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data.

History

  1. Increased mobile usage creates need for efficient data loading
  2. Variety of different frontend frameworks and platforms on the client-side 
  3. Fast development speed and expectation for rapid feature development

GraphQL lets you:

  • Ask for what you need, get exactly that
  • Get many resources in a single request

  • Describe what’s possible with a type system

  • Evolve your API without versions

  • Bring your own data and code

  • Move faster with powerful developer tools

REST vs GraphQL

  1. Describe data requirements

  2. Display information in the UI

REST vs GraphQL

  1. Construct and send HTTP request

  2. Receive and parse server response

  3. Store data locally

  4. Display information in the UI

GraphQL(client)

While queries run in parallel, mutations run one after another

GraphQL(server)

Apollo

Useful links

  1. https://graphql.org/learn/
  2. https://www.howtographql.com/
  3. https://www.apollographql.com/docs/
  4. https://github.com/yuliaHope/rss-graphql-demo

Demo

Made with Slides.com