GraphQL is a young technology; it is open source, and it is a query language for APIs. It supports reading, writing, and real-time updates. GraphQL describes APIs using GraphQL Schemas, and its specification defines its own language known as The GraphQL Schema Definition Language (SDL). This SDL is simple and intuitive; powerful and expressive.
If you are going to build an API with GraphQL, there are few things you should know. There are two ways to create GraphQL schema. The first way is the code-first approach, where you describe your schemas as JavaScript objects and the SDL gets automatically generated from source code; and the second way is the schema-first approach, where schemas are described in SDL using Apollo graphql-tools library.
A new project, initialized with npm, must be created to run a basic GraphQL server, and configure Babel. In GraphQL, the functions of API are divided into three sets, which are
The purpose of creating API is to have software that can be integrated by other external services. This means if your app is made up of a single frontend, you can consider this frontend as an external service, and you’ll be able to work multiple projects using API. When designing an API, it is ideal to choose the best bet for the project and what brings you closer to a desired solution.