GraphQL Benefits

  • avoid over-fetching - send a 'POST' query describing what data you want in one call, the final JSON returned in in the shape you desire
  • prevent multiple API calls -
  • less communication overhead with API developers
  • self-documenting - every GraphQLAPI conforms to a "schema" (graph data model) and what kinds of queries a client can make
  • strong type system to define what the API look like

Caveats

  • monitoring tool has to parse the response body to see if the server is return data or error
  • queries can not be cached in the same way as REST APIs because it's served over a single endpoint
    • because of tooling, caching on the client side is better than REST
      • Apollo Client and URQL implements caching layer