Introduction to GraphQL
This course has been updated! We now recommend you take the Server-Side GraphQL in Node.js course.
Table of Contents
IntroductionScott introduces the course repo, and recommends tools that will be utilized in the course.
What is GraphQL?Scott defines the key points to know about GraphQL.
GraphQL vs RESTScott contrasts GraphQL and REST because the two are often confused.
Course Code OverviewScott goes over the package.json, environment variables, and a brief overview of what the rest of the course repository contains. The context of the API that will be created is also discussed.
GraphQL Basics & Starting the ServerScott demonstrates how to create simple types in the schema, and starts the server.
GraphQL PlaygroundScott demonstrates some of the capabilities of the GraphQL playground.
GraphQL Exploration ExerciseStudents are instructed to set aside 10 minutes to explore the code, and the GraphQL playground.
GraphQL Q&AQuestions are asked about the VSCode GraphQL extension, a clarification about the schemas and resolvers, and Apollo server's relation to Express.
GraphQL Exploration ReviewScott demonstrates how to create a type that is type String instead of an Object.
GraphQL SchemasScott contrasts the GraphQL and database schemas.
Schema Definition LanguageScott explains why a Schema Definition Language, or SDL, is the best way to create schemas.
Scalar & Object TypesScott describes what scalars are and the object types that exist in GraphQL.
Validations: Non Nullable & ListScott demonstrates how to require that a field be populated by GraphQL.
GraphQL Cheat SheetScott references a resource to utilize when constructing a GraphQL Schema.
Query & Mutation TypesScott explains why queries and mutations are instrumental in a functional API.
Writing a Mutation TypeScott demonstrates how to write a mutation with an input type.
Create a Schema ExerciseStudents are instructed to create a schema that passes several tests that check for fields, queries, and mutations.
Create a Schema SolutionScott live codes the solution to the exercise.
GraphQL Schemas Q&AQuestions are asked regarding where the GQL file gets used, if content is required to be returned, what the schema would look like in a real world application,
ResolversScott introduces what Resolvers are, and why they matter.
Resolver ArgumentsScott demonstrates how to start writing a resolver that takes a starting object, any arguments from the incoming request, context, and AST of the incoming request.
Errors in ResolversScott explains how errors are handled in GraphQL.
Implimenting a ResolverScott live codes several resolvers to demonstrate how the data is called.
Field Type ResolversScott live codes field types underneath the resolvers.
Nested ResolversScott demonstrates how resolvers can reference other resolvers and return a value.
Relational DataScott demonstrates why GraphQL needs to be strongly typed by walking through an example involving relational data.
Query ErrorsScott demonstrates what an error looks like as a response from the API.
Info Resolver ArgumentScott shows the audience what the info argument looks like to give context to what is meant by an AST.
Resolvers ExerciseStudents are instructed to create resolvers for the Queries and Mutations on the product type.
Resolvers SolutionScott live codes the solution to the exercise.
Resolvers Q&AScott answers questions from the audience about clarifications on the last exercise, including how Apollo is processing the schema, extending the current example, and usage of the spread operator in this case.
InterfacesScott explains how to utilize interfaces as a base type when types are very similar.
UnionsScott explains how to utilize unions, which allow the user to return more than just one type.
Interfaces ExerciseStudents are instructed to create an interface from the product type, then create types for each possible type.
Interfaces SolutionScott live codes the solution to the exercise.
AuthenticationScott introduces several ways that authentication could take place.
Authentication ExerciseStudents are instructed to authenticate a request, and block requests when appropriate.
Authentication SolutionScott live codes the solution to the exercise.
Testing with JestScott gives an overview on how the tests were written for the course.
Caching & PerformanceScott gives references to resources, and strategies to handle caching, and improve performance.
Dates & Custom ScalarsScott gives a reference to explore more on dates and custom scalars.
Layering GraphQL on RESTScott gives thoughts on layering GraphQL on to of REST.
Sending Multiple QueriesScott demonstrates how to use an alias to perform two requests on a GraphQL server at the same time.
More GraphQL Tools & ServicesScott gives examples of several products that will spin up a GraphQL API for you, tools to make GraphQL easy to work with anywhere, and other resources.