• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

aws-samples/aws-amplify-graphql: Sample using AWS Amplify and AWS AppSync togeth ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

aws-samples/aws-amplify-graphql

开源软件地址(OpenSource Url):

https://github.com/aws-samples/aws-amplify-graphql

开源编程语言(OpenSource Language):

JavaScript 87.3%

开源软件介绍(OpenSource Introduction):

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

Architecture Overview

Architecture

Prerequisites

Getting Started

  1. Clone this repo locally.
git clone https://github.com/aws-samples/aws-amplify-graphql.git
cd aws-amplify-graphql
  1. Initialize the amplify project.
amplify init
  1. Configure an Amazon Cognito User Pool to manage user credentials.
amplify add auth

Architecture

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

Architecture

  1. 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.

Architecture

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.

  1. 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.
  1. Install client dependencies.
npm install

# or
yarn
  1. 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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap