Chapter 8. AWS AppSync In-Depth

In Chapter 3, we learned about GraphQL and created a basic GraphQL API. In this chapter, we’ll expand upon these concepts to create a music festival app using AWS AppSync, from this book’s GitHub repo.

This app will require the following:

  • Amazon DynamoDB tables will be used for shows and stages.

  • GraphQL API will be used for creating, reading, updating, deleting, and listing shows and stages.

  • Only admins should be able to create, update, or delete a show or a stage.

  • All users should be able to view shows and stages.

  • Relationships should be enabled between shows and stages.

  • Users should be able to view all shows as well as navigate to view show details.

Building Skills for GraphQL, AppSync API, and React Router

In this section, we’ll cover how to model relationships between GraphQL types, how to implement authorization rules on GraphQL types and fields, how to enable multiple authorization modes for an AppSync API, and how to enable route parameters using React Router.

First we’ll briefly cover each of these topics, and when we start building out the app, we will get into them in greater depth.

Relationships Between GraphQL Types

When creating a GraphQL API, or any API, modeling relationships between data becomes very important to understand. For example, the app that we are building will have the following two types:

Stage

This type will hold the stage information for individual performances, including the stage name and stage ID. ...

Get Full Stack Serverless now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.