GraphQL

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.

Both GraphQL and REST send HTTP requests and receive HTTP repossess.

In GraphQL you ask for the exact resource type and its fields

GET /graphql?query={book(id: 3){title, authors {name}})

The API provider figures it out in the backend how to get all of this information and return a JSON response.

GraphQL doesn’t use URLs to specify its resource, its uses schemas

Drawbacks

  • We need special tools to interact, both in the client and server

  • It is more difficult to cache

  • Uses HTTP POST by default?

  • Adds complexity and security on how data is retrieved from the database.

Resources

Last updated