Back to Concepts
#09

GraphQL

GraphQL is a query language for APIs. Unlike REST, where you often get too much or too little data (Over/Under fetching), GraphQL allows the client to ask for exactly what they need.

"Give me just the name and age." -> Server returns just the name and age.

Query
query {
  user(id: "1") {



  }
}
Response (JSON)
{
  "data": {
    "user": {
      "name": "Alice"
    }
  }
}