What is GraphQL?
GraphQL is an API specification standard and an Open-Source data query and manipulation language. It has a server-side runtime fulfilling those queries along with the data. In other words, GraphQL follows WYAIWYG pattern What You Ask Is What You Get. GraphQL allows declarative data fetching where a client can specify what data it needs from an API.
Facebook invented GraphQL, and now it is maintained by a large community of companies and individuals all over the world. GraphQL is a specification and, users shall create their implementation on different platforms conforming to the specification. Therefore, Netflix Open-Sourced their implementation called Falcor. An easy example for folks coming from Test Automation world, it is like WebDriver being a W3C Specification, Selenium and WebDriverIO are its browser automation implementation.
GraphQL has two parts:
- A Server component, a GraphQL server to accept the incoming requests and send back data precisely.
- A Client component, to send a POST request (with payload) to the GraphQL server.
GraphQL uses a type system to define the capabilities of an API. All the types declared in an API are written in a schema using the GraphQL Schema. Namely, Schema Definition Language (SDL). It serves as a contract between the client and the server to define how a client can access the data. Defining the Schema allows the back-end and front-end teams to concentrate on their piece of work without much communication.
More content here: https://blog.testproject.io/2020/06/11/introduction-and-getting-started-with-graphql/
Top comments (0)