What is GraphQL?

  • GraphQL is a query language and server-side runtime for application programming interfaces (APIs) that prioritizes giving clients exactly the data they request and no more.

    GraphQL is designed to make it easier to build a rich and performant API.

  • How does it works?

    In a simple GraphQL service, the incoming query is parsed, and the query fields are resolved against the schema to produce the result. The result is then serialized to JSON and returned to the client.

  • Example GraphQL query

    query {
      comments {
        id
        text
      }
    }
    
  • Example GraphQL schema

    type Query {
      comments: [Comment]
    }
    type Comment {
      id: ID!
      text: String
    }