Primer

GraphQL is an API query language. It uses a specific syntax to query a server to request or mutate data. It is an alternative to REST, which is accessed through different endpoints.

Drawbacks of REST

  • Overfetching: Getting back more data than we need. In the following example, we might request just the names of the courses, but it may provide a bunch of other data that we do not need. This means it gives out extra data.

GET ../api/courses

{
id: 1,
name: 'something',
thumb_url: 'URL'
}
  • Underfetching: Getting back less data than we need.

Last updated