当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

aws-mobile-appsync-events-starter-react

授权协议 Apache-2.0 License
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 高海阳
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Introduction

This is a Starter React application for using the Sample app in the AWS AppSync console when building your GraphQL API. The Sample app creates a GraphQL schema and provisions Amazon DynamoDB resources, then connects them appropriately with Resolvers. The application demonstrates GraphQL Mutations, Queries and Subscriptions using AWS AppSync. You can use this for learning purposes or adapt either the application or the GraphQL Schema to meet your needs.

Features

  • GraphQL Mutations

    • Create new events
    • Create comments on existing events
  • GraphQL Queries

    • Get all events
    • Get an event by Id
  • GraphQL Subscriptions

    • Real time updates for comments on an event
  • Authorization

    • The app uses API Key as the authorization mechanism

AWS Setup

  1. Navigate to the AWS AppSync console using the URL: http://console.aws.amazon.com/appsync/home

  2. Click on Create API and select the Event App under the sample project in the bottom pane, and select Start. Enter a API name of your choice. Click Create.

React Setup

First, clone this repo:

git clone https://github.com/aws-samples/aws-mobile-appsync-events-starter-react.git
cd ./aws-mobile-appsync-events-starter-react

Wait until the progress bar at the top has completed deploying your resources. Then from the integration page of your GraphQL API (you can click the name you entered in the left hand navigation).

On this same page, select JavaScript at the bottom to download your aws-exports.js configuration file by clicking the Download Config button. Replace the aws-exports.js file in the root of your app with the file you just downloaded.

Install dependencies

npm install

Start the application:

npm run start

Application Walkthrough

./src/App.js

  • Sets up the application navigation between screens using BrowserRouter from React Router.
  • Configures the AWSAppSyncClient using an API Key. This can be confugured to use Amazon Cognito Identity or Amazon Cognito User Pools as well.

./Components/AllEvents.js

  • Uses Higher Order Components for making GraphQL calls to AWS AppSync.
  • View to display all the events from ./GraphQL/QueryAllEvents.js
  • Allows you to delete individual events. This will use ./GraphQL/MutationDeleteEvent.js

./Components/NewEvent.js

  • Uses Higher Order Components for making GraphQL calls to AWS AppSync.
  • View to create a new event using ./GraphQL/MutationCreateEvent.js

./Components/ViewEvent.js and EventComment.js

  • Uses Higher Order Components for making GraphQL calls to AWS AppSync.
  • ViewEvent gets all the comments for a specific event when page loads with a GraphQL query defined in ./GraphQL/QueryGetEvent
  • Once the page loads, EventComments sets up a GraphQL subscription using ./GraphQL/SubscriptionEventComments to display any new comments on an event in realtime.

./GraphQL Directory

  • Contains GraphQL queries and mutations for interacting with AWS AppSync.
 相关资料
  • ChatQL: An AWS AppSync Chat Starter App written in Angular Quicklinks Introduction Features Getting Started Prerequisites Backend setup Application Walkthrough AWS Pinpoint Analytics Building, Deployi

  • AWS AppSync JavaScript SDK This SDK provides Apollo links that can be used with the Apollo JavaScript client version 3. Please log questions for this client SDK in this repo and questions for the AppS

  • AWS Mobile React Native Starter App - Serverless Pet Tracker This sample application has been archived in favor of Amplify JS Samples. While the archived repository will still work, please go +1 this

  • AWS AppSync AWS AppSync is a managed GraphQL service for application data and a back-end for mobile, web, and enterprise applications. Awesome AWS AppSync curates the best AWS AppSync, tools, tutorial

  • 我计划使用AWS Appsync迁移lambda函数中的graphQLendpoint,该函数由通过API网关的POST触发。我研究AppSync主要是因为订阅,我无法使用Lambda函数创建订阅。 我的身份验证机制基于Auth0,使用无密码,我的授权机制基于DynamoDB中几个表的数据,并嵌入到graphQL解析器中,这是Facebook和Apollo推荐的。 更重要的是,它基于请求的每一部分

  • Amplify是否支持此处概述的脱机功能:https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html#offline-背景 我应该这样设置吗?https://aws.github.io/aws-amplify/media/api_guide#configuration-for-graphq