emimuresan / react-apollo-hooks

Demo project with React-Apollo v3.0 beta (hooks ftw!)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
  1. Set up Amplify
$ amplify init
  1. Install Amplify libraries
$ npm install aws-amplify @aws-amplify/ui-react
  1. Setup the frontend (add code in src/index.js)
import Amplify from "aws-amplify";
import awsExports from "./aws-exports";
Amplify.configure(awsExports);
  1. Add a GraphQL API and automatically provision a database
$ amplify add api
  1. Deploying the API
$ amplify push
  1. 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

About

Demo project with React-Apollo v3.0 beta (hooks ftw!)


Languages

Language:JavaScript 92.7%Language:HTML 5.7%Language:CSS 1.6%