Graphql

  • GraphQL is an open-source data query language and data manipulation language for APIs, and a query runtime engine.
  • Advantages:
    • Clients have the ability to dictate exactly what they need from the server and receive that data in a predictable way.
    • Reduce the amount of unnecessary data transferred over the network.
    • Better documetation
    • strongly-typed schema (reduces errors)
    • Platform agnostic (can be used on web, mobile etc.)
    • Easy to evolve and maintain: With a GraphQL API, it’s easy to add new fields, without having to worry about breaking existing client code, which results in less maintenance and fewer chances of introducing bugs.
  • Example Java server libraries:
    • Domain Graph Service (DGS) by Netflix: netflix/dgs-framework
    • Graphql Spring boot: graphql-java-kickstart/graphql-spring-boot
  • Example client libraries:
    • Appollo (Web, iOS, Android)

Syntax