Introduction to GraphQL
GraphQL is a protocol built on top of HTTP that allows highly customised requests in the shape of graphs that can map relational data found amongst a variety of different data sources.
There are three ways to interact with data types held in a schema
Use queries to fetch data. These can be as simple as a request for a single entity or more complex to attain a deep object that represents collections of data from many resources.
Use mutations to request persistent changes to data. Again these can follow a similar structure as with queries.
Subscription allow you to listen to updates to data over a managed websocket connection. Data can be pushed from the server and show instantly in realtime in the application. Perfect for use with a messaging application.
Resolvers do the leg work in fetching data from various resources These can be functions that return promises. Data returned from resolvers can be linked in the schema to further fetch related data to build a complex response. This is all based on the shape of the request for data.