Table of Contents
Introducing Advanced GraphQLScott Moss introduces himself and provides a high-level overview of GraphQL APIs.
GraphQL API RecapScott shows how to use graphql-yoga node module to get the GraphQL server up and running. Given a GraphQL Schema, you will need to create a server the correctly allows a query and mutation based on the schema.
GraphQL Recap: Schema DefinitionsScott defines the different parts of the schema including types, queries, and inputs to get GraphQL started.
GraphQL Recap: MutationsAfter discussing the difference between queries and mutations, Scott codes a basic mutation to add data into the database.
Github Token SetupScott shows how to generate private Github token to be able to query the Github API in following exercises.
GraphQL Recap ExerciseScott sets up a basic "Hello, World!" exercise to generate a schema and play with queries and mutations.
Q&A: Mutation vs. Query & Type vs. InputScott talks about mutating the database on the query and recommends against this approach. Then Scott answers a question was asked about using types as inputs and being able to define the types as inputs all the way down.
GraphQL Recap SolutionScott walks through the solution to the GraphQL Recap Exercise using queries and mutations.
Querying the SolutionScott demonstrates querying the solution and discusses different ways to query in GraphQL.
Q&A: Multiple Mutations & BatchingScott discusses optimizing GraphQL using multiple operations and batching.
Introducing Resolvers & SetupScott overviews what resolvers are and how they tie into schemas.
Code Repository WalkthroughScott reviews the code repository and where to find the resolvers.
ArgumentsWhile arguments can be different depending on when the resolver was called, resolvers almost always receive four arguments. Scott takes questions from students.
Arguments: ContextScott illustrates context as dependency injectors for resolvers by showing how to use context to share state across your resolvers.
Info Object ASTScott demonstrates info objects, which are raw query information and a query AST inside resolvers.
Nested Resolvers ExerciseScott shows that, when given a query, the types and resolvers need to be created, so the query executes correctly.
Nested Resolvers SolutionScott walks through the solution to the Nested Resolvers Exercise showing how to efficiently implementing the resolvers because resolvers can go on and on and on, creating a tree and become confusing.
Query FragmentsScott introduces fragments, which reduce repetitive nature of asking for the same data in the same query.
EnumsScott reviews enums, which are a set of constant values to validate fields on types and inputs.
InterfacesSince types might share common fields, Scott shows how to use interfaces to clean up the repetition in schema definitions.
UnionsScott introduces unions, which are used to return a type that could be one of a collection of types.
Unions vs. InterfacesScott compares unions and interfaces. Unions are a group of types that do not share fields but need to be queried on whereas Interfaces are more often use in GraphQL because of shared fields.
Interfaces & Unions ExerciseIn this exercise, students use fragments, unions, and interfaces to clean up repetitive queries and schema.
Interfaces & Unions SolutionScott walks through Interfaces & Unions Exercise showing the proper way to stay DRY with GraphQL.
Optimizing ResolversScott discusses caching problems with GraphQL and how to use "pre-resolving" to cache the results to avoid extra database calls.
Caching in GraphQLScott reviews the nature of "pre" resolvers that can separate data access logic to other resolvers which can lead to performance issues.
Data LoadersSince resolvers can access the same data that the previous resolvers might have, Scott talks about how to use data loaders to batch and cache that data, per request.
Using Data LoadersScott walks through a coding demonstrating on how to use data loaders.
Data Loaders ExerciseIn this exercise, students use data loaders to speed up your queries.
Data Loaders SolutionScott walks through the solution to the Data Loaders Exercise by showing how to speed up the resolvers' efficiency.
GitHub API Data LoadersIn this additional data loader example, Scott shows the solution to using data loader with the GitHub API.
Simplifying ResolversSince resolvers are just functions, Scott shows resolvers are more accessible to test when breaking them down.
Unit Test Resolvers with JestScott illustrates that GraphQL can run anywhere because a server does not need to test GraphQL server.
Integration Test with JestScott demonstrates how to set up an integration test with Jest.
Unit & Integration Test ExerciseIn this exericse, students code a unit and integration test.
Unit & Integration Test SolutionScott walks through the solution to the Unit & Integration Test Exercise showing how to test GraphQL servers.
Schema StitchingScott shows how to combine GraphQL APIs from multiple sources, even remote ones.
Database to GraphQLUsing prisma, Scott discusses how to turn a database into a GraphQL API.
Subscriptions and GraphQL ServicesScott wraps up Advanced GraphQL discussing subscriptions, GraphQL services, and taking questions from students.