Episode 107 - GraphQL Pros and Cons, examples and when to use over REST

Published: Sept. 26, 2019, 4:35 a.m.

GraphQL Pros and Cons, examples and when to use over REST

GraphQL is an open source query language developed by facebook that allows clients to formulate queries to get different results. Its main goal is to combine multiple services into one endpoint. In this video we will discuss what is GraphQL, why facebook developed it, go through some examples using github GraphQL API, finally we will discuss the pros and cons and when you should use this technology.

  • What is GraphQL?
  • Examples
  • Pros and Cons
  • when to use REST vs GRAPHQL

What is GraphQL

  • Schema
  • Query language
  • Nesting
  • Mutation and subscription

Examples

Schema intro

Github API

Rest api

Pros

  • Flexibility
  • efficient response : payload back only get what you want of fields since you know the schema
  • No round trips- Avoiding multiple round trips (HATEOS REST)
  • Uniform single interface API endpoint
  • Self documenting

Cons

  • Complexity
  • Typed system - ( use it to know if a type is available or not and fork logic) slows down adoption.. same as soap
  • No Caching etag since always POST
  • Error management non-standard for HTTP.
  • Over engineering can lead to Inefficiency of the joins can lead to performance and DOS
--- Send in a voice message: https://anchor.fm/hnasr/message