aws-samples/aws-amplify-graphql

Name: aws-amplify-graphql

Owner: AWS Samples

Description: Sample using AWS Amplify and AWS AppSync together for user login and authorization when making GraphQL queries and mutations. Also includes complex objects for uploading and downloading data to and from S3 with a React app.

Created: 2018-02-19 18:09:11.0

Updated: 2018-03-20 10:44:39.0

Pushed: 2018-03-17 01:53:00.0

Homepage: null

Size: 5940

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

AWS AppSync GraphQL Photo Sample

Please submit issues to the appsync-sdk-js repository.

Demo

This sample application shows how to use GraphQL to build an application that a user can login to the system, then upload and download photos which are private to them. The sample is written in React and uses AWS AppSync, Amazon Cognito, Amazon DynamoDB and Amazon S3 as well as the AWS Mobile CLI.

Architecture Overview

Architecture

Prerequisites
Getting Started
  1. Clone this repo locally.

  2. Go to the photo-client folder inside of the cloned repo.

    /photo-client
    
  3. Run awsmobile init with default settings

    obile init --yes
    
  4. Configure Amazon Cognito User Pool as authentication type

    obile appsync configure
    
  5. Select AMAZON_COGNITO_USER_POOLS

  6. Confirm defaults

  7. Update changes

    obile push
    
  8. Run your app

    obile run
    

The awsmobile-cli will create your Amazon Cognito User Pool and Identity Pool, an Amazon S3 bucket with private directories to store each user's photo and an AWS AppSync API that uses Amazon DynamoDB to store data.

The sample uses AWS Amplify to perform the Sign-Up and Sign-In flows with a Higher Order Component.

If the application runs successfully you should be able to enter the name of a photo, choose a file and then press Add photo. This will make a GraphQL call to enter the record into the database and simultaneously upload the object to S3. An immediate fetch of the record will then be at the bottom of the screen.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.