revirth / what-is-graphql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL

GraphQL: The Documentary (Official Release)

REST

Overfetching

  • client downloads more information than is actually required in the app

Underfetching

  • endpoint doesn’t provide enough of the required information
  • it needs to make one additional request per element to fetch the required data

Pros and Cons

  • https://stablekernel.com/advantages-and-disadvantages-of-graphql/

    👍

    • clients have the ability to dictate exactly what they need from the server, and receive that data in a predictable way
    • ability to retrieve many resources in a single request
    • strongly-typed API

    Every GraphQL service defines a set of types which completely describe the set of possible data you can query on that service. Then, when queries come in, they are validated and executed against that schema

    👎

    • queries always return a HTTP status code of 200
      • If your query is unsuccessful, your response JSON will have a top-level errors key with associated error messages and stacktrace
    • lack of built-in caching support
    • complexity
    • N+1 Problem - https://github.com/graphql/dataloader

Case

ref

About


Languages

Language:JavaScript 59.5%Language:C# 17.3%Language:TypeScript 16.3%Language:CSS 3.4%Language:HTML 3.4%