Apollo Playground

Apollo playground and runs on the client side for us automatically.

The Apollo playground is a graphical interactive, in-browser GraphQL IDE.

So in the last post the last command that we run was: “npm start” then if we open the browser on http://localhost:4000/ we are going to see this:

Apollo just create this interface for us, that’s cool!

If we click on the Schema: we are going to see all the stuff that we defined, like the query, the type

But, how the playground get all of that information? well, this is done in GraphQL at Apollo through this process called introspection.

Introspection

Is the ability to query which resources are available in the current API schema. Given the API, via introspection, we can see the queries, types, fields, and directives it supports.

Let’s use Postman instead to see what is goin on:

All the interactions with GraphQL API is done over HTTP POST.

Postman support a body type of GraphQL, so we can access to the introspection system like “__query” so let’s write the next lines on Postman and click on Send button:

Let’s look the result: this __ indicate that they are part of the introspection system.

Now if we run this next query:

{
    __type(name: "Session") {
        name
        fields {
            name
            type {
                name
                kind
            }
        }
    }
}

We can see the next result:

The result give us information about the query but doesn’t get us too far. We can’t actually call the sessions query, because it doesn’t do anything, for that we need to implement something called resolver in the next post.

By Cristina Rojas.