React Apollo Demo Project
Demo project with React-Apollo v3.0 beta and AWS AppSync & Amplify used to create a serverless GraphQL backend.
This project was bootstrapped with Create React App.
How to Initialize a Backend
Prerequisite: Install and configure the Amplify CLI.
$ amplify configure
- Set up Amplify
$ amplify init
- Install Amplify libraries
$ npm install aws-amplify @aws-amplify/ui-react
- Setup the frontend (add code in
src/index.js
)
import Amplify from "aws-amplify";
import awsExports from "./aws-exports";
Amplify.configure(awsExports);
- Add a GraphQL API and automatically provision a database
$ amplify add api
- Deploying the API
$ amplify push
- Check Amplify’s status
$ amplify status
$ amplify console api
The fronted is now ready to be connected to the API using the API key.
More detailed steps can be found here.
Available Scripts
In the project directory, you can run:
yarn start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
yarn test
Launches the test runner in the interactive watch mode.
yarn build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
Docs
Apollo Client (React) v3.0: https://www.apollographql.com/docs/react/v3.0-beta