GraphQL
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. It is an alternative to REST, quickly gaining popularity as a tool for building and fetching declarative data.
GraphQL isn’t tied to any specific database or storage engine and is instead backed by your existing code and data.
For example the query:
{
me {
name
}
}
Could produce the JSON result:
{
"me": {
"name": "Spongebob Squarepants"
}
}
For that you need to create a service
type Query {
me: User
}
type User {
id: ID
name: String
}
along with functions for each field type
function Query_me(request) {
return request.auth.user;
}
function User_name(user) {
return user.getName();
}
Apollo Client is the ultra-flexible, community-driven GraphQL client for React, JavaScript, and native platforms.
Graphcms You build essential infrastructure for your digital products. We build a headless CMS for your content creators.