Objectives

Develop real-world GraphQL server using Node.js and Apollo Server

Think in terms of GraphQL, and how it differs from other API schemes

Learn the GraphQL Type System

Code Resolver Functions

Learn the Query, Mutation and Subscription GraphQL syntax

Execute Queries, Mutations and Subscriptions in the GraphiQL IDE

Write AJAX Calls to call the GraphQL server

Prerequisites

Attendees should have a good working knowledge of ES2015 JavaScript. Experience writing Node.js application is a huge plus. Students are strongly encouraged to take the Introduction to JavaScript course if they have no JavaScript experience.

Duration

Two days

 

Outline for Introduction to GraphQL with Apollo Server Training

The course can be taught in either the JavaScript or the TypeScript languages. Knowledge of JavaScript is needed for both language versions of the course. Knowledge of TypeScript is NOT needed for the TypeScript version.

Chapter 1. Introduction to GraphQL

What is GraphQL?

GraphQL compared to REST Services

Thinking in GraphQL

Benefits of GraphQL and Apollo Server

Node.js and NPM (covered as needed)

Debugging Node.js Applications

ES2015 + JavaScript Syntax (covered as needed)

Chapter 2. Data Sources & Resolvers

Use Node.js to Access Asynchronous Data Source

Asynchronous JavaScript Programming (covered as needed)

Closures, Callbacks, Promises, Async/Await (covered as needed)

Wrap a REST API in GraphQL

Implement Resolvers

Default Resolvers

Query and Mutation Resolvers

Wire up Subscriptions

Resolve Type

Chapter 3. GraphQL Types and Server Configuration

Schema, Object, Input, Scalar, & List Types

Interface Types

Understanding Fields, Arguments and Resolve

Enum, Union, Interface Types

Inline Fragments

Directives

Introspection Queries

Chapter 4. GraphQL Queries

What is a Query?

GraphQL Query Syntax

Use GraphiQL IDE to perform queries

Use GraphiQL IDE to perform queries

Passing arguments into queries.

Renaming a field with aliasing.

Breaking a large query into fragments.

Nesting many fragments.

Chapter 5. GraphQL Mutations

What is a Mutation?

GraphQL Mutation Syntax

Use GraphiQL IDE to perform mutations

Purpose of Input Object Type

Mutation Queries with Variables

Structure Mutation Query Results

Handling Error from Failed Mutations

Chapter 6. GraphQL Subscriptions

What is a Subscription?

GraphQL Subscription Syntax

Use GraphiQL IDE to perform subscriptions

Code subscription resolver

Chapter 7. Web Browser Client

Using the Fetch API to perform a Query

Using the Fetch API to perform a Mutation

Using the Web Socket API to perform a Subscription