An Interactive Intro
http://graphql.org
graphqlhub.com
Open source project made by Facebook to explore graphql
Is a standard language
{
github {
user {
id
company
avatar_url
}
}
}
SELECT id, company, avatar_url
FROM users
WHERE username = "theRemix";
db.users.find({ username : "theRemix" },
{ id : true,
company : true,
avatar_url : true
}
);
curl https://api.github.com/users/theRemix
{
github {
user (username: "theRemix") {
id
company
avatar_url
}
}
}
__schema {
types {
name
}
}
__schema {
queryType {
fields {
name
description
}
}
}
More queries!
repo (ownerUsername: "facebook", name: "graphql") {
name
commits {
message
}
}
More queries!
showing all commit messages for each repo
user (username: "theRemix") {
id
company
avatar_url
repos {
name
commits {
message
}
}
}
do same thing to compare
118 repos!
The default operation
query GithubUserRepos {
github {
user(username: "theRemix") {
...
query GithubQueryRepo {
github {
repo(ownerUsername: "facebook", name: "graphql") {
...
GraphQL Top Level Operation
GraphQL Top Level Operation
GraphQL Top Level Operation
Queries composed of fragments
fragment RepoInfo on GithubRepo {
name
commits {
message
}
}
...RepoInfo
Re-usable Queries are more useful
query GithubUserRepos ($username:String!) {
github {
user(username: $username) {
...
{
"username": "sgnl"
}
Cause sometimes you need 'em
company_name: company
Alter GraphQL's execution behavior
avatar_url @include(if: $showAvatar)