aws-samples/aws-amplify-graphql
关于
示例展示如何结合使用 AWS Amplify 和 AWS AppSync,在执行 GraphQL 查询和变更时实现用户登录与授权。此外还包含复杂对象,演示如何通过 React 应用在 S3 与本地之间上传和下载数据。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文AWS AppSync GraphQL Photo Sample
Please submit issues to the appsync-sdk-js repository.

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 Amplify CLI.
Architecture Overview

Prerequisites
-
npm install -g @aws-amplify/cliamplify configure
Getting Started
- Clone this repo locally.
git clone https://github.com/aws-samples/aws-amplify-graphql.git
cd aws-amplify-graphql
- Initialize the amplify project.
amplify init
- Configure an Amazon Cognito User Pool to manage user credentials.
amplify add auth

- Configure an Amazon S3 bucket to store files.
amplify add storage

- Configure an AWS AppSync API to interact with my backend data sources such as Amazon DynamoDB, Amazon Elasticsearch, AWS Lambda, and self hosted HTTP services.
amplify add api
# When prompted for a schema.graphql provide the value "schema.graphql"
# to point to the file checked in to the root of the project directory.

After running this command, you edit the schema.graphql located at
amplify/backend/api/<-projectname->/schema.graphql. You may delete the one at the root of the project directory as it will no longer be used.
- Deploy your project.
amplify push
# When asked if you would like to generate client code, you can
# say no since we are using plain JavaScript.
- Install client dependencies.
npm install
# or
yarn
- Run the react application
npm run start
# or
yarn start
The AWS Amplify CLI will create an 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.
探索相关项目
加载中…