Introduction to GraphQL with Apollo Server

2-Day Course Taught Live as In-Person or Online

Course Description

Training 4 Developers’ Introduction to GraphQL with Apollo Server training course teaches attendees how to build a GraphQL server powered by Node.js and Apollo Server. Students develop a real-world GraphQL server from which they can query data, apply mutations, and connect to via subscriptions. The primary focus on the class is the GraphQL language including its type system. The Apollo Server platform provides a useful way to learn the GraphQL language. While the focus of the course is GraphQL itself, because of how Apollo Server is utilized the student will learn a lot about Apollo Server and Node.js as well. As part of the course, students will query data from an existing REST API to show how GraphQL can be incrementally adopted within existing server API infrastructures.

Students will build a GraphQL server project using JavaScript, Node.js, and the Apollo Server. Developers can do wonders with GraphQL, it’s a great replacement for other API schemes such as REST APIs and SOAP. Using the GraphiQL IDE, students will perform queries, mutations, and subscriptions. Also, students will explore how to call the GraphQL server through a normal AJAX call. The primary focus will be thinking in GraphQL and learning the type system including objects, input objects, interfaces, and unions. Also, query features such as fragments, inline fragments, operation names, variables, and directives will be explored.

Course ObjectivesObjectives

  • 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

Course PrerequisitesPrerequisites

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 ES2019 JabaScript course if they have no JavaScript experience.

Course RequirementsRequirements

We teach all classes online using Zoom. Students will need to be able to join a Zoom session. We recommend that each student have two displays. One display to view the instructor presentation and one display to use for note-taking and coding along with the instructor. All course materials are distributed via GitHub and Google Drive. Access to those services is needed for the class, please ensure your firewall and network policies will allow students to access those resources.

Course OutlineOutline

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.

  1. Introduction to GraphQL
    1. What is GraphQL?
    2. GraphQL compared to REST Services
    3. Thinking in GraphQL
    4. Benefits of GraphQL and Apollo Server
    5. Node.js and NPM (covered as needed)
    6. Debugging Node.js Applications
    7. ES2015 + JavaScript Syntax (covered as needed)
  2. Data Sources & Resolvers
    1. Use Node.js to Access Asynchronous Data Source
    2. Asynchronous JavaScript Programming (covered as needed)
    3. Closures, Callbacks, Promises, Async/Await (covered as needed)
    4. Wrap a REST API in GraphQL
    5. Implement Resolvers
    6. Default Resolvers
    7. Query and Mutation Resolvers
    8. Wire up Subscriptions
    9. Resolve Type
  3. GraphQL Types and Server Configuration
    1. Schema, Object, Input, Scalar, & List Types
    2. Interface Types
    3. Understanding Fields, Arguments and Resolve
    4. Enum, Union, Interface Types
    5. Inline Fragments
    6. Directives
    7. Introspection Queries
  4. GraphQL Queries
    1. What is a Query?
    2. GraphQL Query Syntax
    3. Use GraphiQL IDE to perform queries
    4. Use GraphiQL IDE to perform queries
    5. Passing arguments into queries.
    6. Renaming a field with aliasing.
    7. Breaking a large query into fragments.
    8. Nesting many fragments.
  5. GraphQL Mutations
    1. What is a Mutation?
    2. GraphQL Mutation Syntax
    3. Use GraphiQL IDE to perform mutations
    4. Purpose of Input Object Type
    5. Mutation Queries with Variables
    6. Structure Mutation Query Results
    7. Handling Error from Failed Mutations
  6. GraphQL Subscriptions
    1. What is a Subscription?
    2. GraphQL Subscription Syntax
    3. Use GraphiQL IDE to perform subscriptions
    4. Code subscription resolver
  7. Web Browser Client
    1. Using the Fetch API to perform a Query
    2. Using the Fetch API to perform a Mutation
    3. Using the Web Socket API to perform a Subscription
Scroll to Top