This sample demonstrates how Gatsby can query an AWS AppSync GraphQL API to display a list of events. It leverages Gatsby's ability to natively query third-party GraphQL APIs.
AWS AppSync is a serverless backend for web and mobile apps powered by GraphQL that also provides real-time and offline capabilities to apps.
- Login to the AWS AppSync console.
- Click
Create API
. - Select the
Event App
sample project. ClickStart
. - Enter a friendly name or keep the default (
"My AppSync API"
). ClickCreate
. - The API and resources will be created in a few seconds and the console will take you to the
Queries
pane with a pre-filled query and mutation. - Run the
CreateEvent
mutation a few times with different names and details for events. - Run the
ListEvents
query to view the events that were created. - Go to the
Settings
pane and copy theAPI URL
and theAPI Key
.
npm i -g gatsby-cli # install the Gatsby CLI
- Clone this repository and navigate into the directory.
npm install # install node dependencies
AWS_APPSYNC_API_URL="<API url from Settings>" AWS_APPSYNC_API_KEY="<API key from settings>" gatsby develop
- Screenshot
This sample is based on gatsby-starter-hello-world and gatsby-github-displayer.
This sample code is made available under a modified MIT license. See the LICENSE file.