What is GraphQL?
GraphQL is a specification that describes a declarative query language in which web and mobile clients can use to ask an API for the exact data they want.
GraphQL core concepts
Schema: Is the center of GraphQL implementation. It describes the functionality available to the clients which are connecting to it.
SDL: Schema Definition Language or SDL is the type system that’s used to define the schema of an API.
Query: Is an API request made by the client machine application. It supports augments and points to arrays. Query is used to read or fetch values.
Mutation: Is a way to change the dataset in GraphQL. It modifies data in the data store and returns a value. Mutations help you to insert, update, or delete data.
Graphql vs Rest
GraphQL and Rest have several differences. Here is a list with the most important.
Characteristics of Rest:
- Fast client-side requirements are not well suited to Rest's static nature.
- Queries are made at various endpoints (URL).
- Download unnecessary information.
- Several endpoints (URL) must be consulted to obtain the information that is being sought.
Characteristics of GraphQL:
- Single endpoint (URL)
- GraphQL uses a strongly typed system to define the capabilities of an API.
- Schemas serve as a contract between the client and the server.
- The Front end and the Back end can work completely independently.
Recommend resources to learn more about GraphQL:
GraphQL ORG - https://graphql.org/
How to GraphQL - https://www.howtographql.com/
GraphQL Cheatsheet - https://raw.githubusercontent.com/sogko/graphql-shorthand-notation-cheat-sheet/master/graphql-shorthand-notation-cheat-sheet.png