GraphQL is a data query language which request a knowledge about the schema of the api.

One of the best “skill” of GraphQL is the multi-db support. You can map multiple database in one api because the graphql server can use multiple source for build the api, and, doing so, add different’s types of db or other type of source at the same time.

In this way you can use with one unique and uniform interface hidding behind it all the architectural dectail with only one point of comunication (the graphql url) with all the user need from the api.

Structure of a GraphQL API

If you want a GraphQL’s API you need to know how the API works.

All the data into the databases are object named Type with multiple Field. Every Field is get by a Resolvers which return a Value.

You will need a Schema, a collection of Types, for describing all the api and make the api working.

You also need to know the difference between Query and Mutation because there are the only action youi can make on a GraphQL API.

A Query is a type of the schema for getting out the datas you will need for your work.

A Mutation is a type of the schema for adding or editing the datas in the databases.

#Why use a GraphQL over Rest ?

Which is the difference between Rest API and a GraphQL API? Because you can get only what you want and nothing more.

Thanks to Relay1 and thanks to the Query you can build a request with a selected number of element2 with only the needed Value3 .
This will be usefull because some type of Query will be resized than the SQL query and you will be writing in a GraphQL language which check for type error and syntactic error and output error if the Query or the Mutation don’t respect the Schema. In this way the Api Admin will allways be in controll of all the operation on the database and the user must be allways knew all the change into the Schema

In this way you will have an api with only what you need for your lightnet app which use only the necessary connection, no more.

Now I’m working on an another article about the python implementation of GraphQL so wait another article.