Difficulty: beginner
Estimated Time: 15 minutes

Video Under Construction

under construction

  • Educational Objective
  • What To Expect
  • What You Need To Know Before You Start
  • Working with GraphQL and IMBOB
  • Scenario Contents

IMPORTANT: You need to do the steps in sequence in order for the state of the lesson's learning environment to be consistent. Otherwise, you'll get behaviors that might be confusing.


Educational Objective

The purpose of the scenario is to present the demonstration GraphQL API, IMBOB and to show users how to perform the following queries and mutations against the IMBOB demonstration API. Also the scenario shows you how to use GraphQL subscriptions and directives.

What To Expect

After taking this scenario you will be able to:

  • To install the IMBOB API in the Katacode interactive learning environment
  • To access an instance of Apollo Server GraphQL Playground bound to the IMBOB API running in the Katacoda interactive learning environment
  • To use to the interactive schema documentation published GraphQL Playground
  • To learn about the details of the IMBOB API using GraphQL introspection
  • To create and implement queries and mutations in GraphQL Query Language against the IMBOB API
  • To register subscriptions to the IMBOB API and receive messages asynchronously upon execution of certain mutations
  • To apply a GraphQL directive to a mutation in executed against the IMBOB API

What You Need To Know Before You Start

In order to get full benenfit from taking this scenario it's use to have a working understanding of the syntax of the GraphQL Query Language. Also it's good to have an understanding of the basics GraphQL operations of query, mutation and subscription.

TO BE PROVIDED

Working with GraphQL and IMBOB

This scenario published a custom built API, IMBOB. IMBOB is a GraphQL API built using Apollo Server. IMBOB publishs data that presents some basic movie information. The API is scaled back to show data for only a few movies.

The reason only a few movies are represented is to provide just enough related data thus enabling the underlying object graph to make sense in term of organization and assocation.

Please be advised that the IMBOB API does provide mutations that allow users to build out the underlying object graph. However, if a mishap occurs, all that required to set the scenario and IMBOB to its initial state is to refresh this web page.

TO BE PROVIDED

Scenario Contents

Step 1 - Running Up The GraphQL API on Katacoda

Step 2 - Accessing and Authenticating to the API

Step 3 - Executing Sample GraphQL Queries

Step 4 - Registering a Subscription

Step 5 - Firing a Subscription Event using the Mutation, Ping

Step 6 - Working with onMovieAdded to Add Data and Generate Asynchronous Messages

Step 7 - Working with the @isAdmin Directive

Step 8 - Working with Connections

You've crossed the finish line!

under construction

In this scenario you learned:

  • TO BE PROVIDED
  • TO BE PROVIDED
  • TO BE PROVIDED
  • TO BE PROVIDED

Next we'll move on to TO BE PROVIDED

Understanding GraphQL Using IMBOB (Under Construction)

Step 1 of 8

Step 1 - Running Up The GraphQL API on Katacoda

Video Under Construction

under construction

First, let's set up the GraphQL API.

Task 1: Get the code from GitHub:

git clone https://github.com/reselbob/IMBOB.git

Task 2: Go to the folder that has the source code and Dockerfile

cd IMBOB

Task 3: Make the Docker image that represents the GraphQL API

docker build -t imbob .

Task 4: Now, create the container

docker run -d -p 80:4000 imbob

Let's check to see that the GraphQL API is up and running

Task 5:: Click the following command the verify that the GraphQL API is up and running.

curl 'http://localhost:80/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: http://localhost:80' -H 'authorization: ch3ddarch33s3' --data-binary '{"query":"mutation{\n ping(messageBody: \"This is a simple message body.\"){\n createdAt\n body\n name\n id\n }\n}"}' --compressed

If all is well you should see a response similar to the following (id and createdAt values will differ by installation.):

{"data":{"ping":{"createdAt":"Sun May 12 2019 15:41:37 GMT+0000 (Coordinated Universal Time)",
         "body":"This is a simple message body.",
         "name":"PING",
         "id":"ac4f1d95-88fc-4953-89b2-00b8096dec00"}}}

Understanding This Step

The purpose of this step was to get the IMBOB API server up and running so that we can experiment with GraphQL queries, mutations and subscriptions.

In the next step we'll be working the GraphQL Playground web page that ships with Apollo server to do work.