Web Technologies

GraphQL

GraphQL lets a client fetch exactly the fields it needs from one endpoint, in one request. How queries, schemas and resolvers work, and when REST fits better.

  • 6 min read
  • 5 questions
  • +35 XP
Transcript

GraphQL, explained by cats. Kitty is hungry. She wants fish treats. She wants milk. She wants a dessert after. With REST API, Kitty must visit many bowls. One bowl for fish treats. Another bowl for milk. Another bowl for snacks.

Trip after trip. So many endpoints. If Kitty wants a new kind of food, say tiramisu, the humans must build or change a new bowl. New endpoint. With GraphQL, Kitty visits one magic bowl. She says exactly what she wants.

Fish treats, milk, snack, and tiramisu, please. The bowl gives exactly that in one go. No new bowl. No new endpoint. No extra food. No wasted trips. One bowl. One request. All the data Kitty needs. That's GraphQL.