peterpham / realtime-chart-appsynclient

A sample webpage to render Real Time chart with AppSyncClient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A sample webpage to render Real Time chart with AppSyncClient

Set up

AppSync

Create an AppSync API with following schema

type ChartData @aws_iam
@aws_api_key {
	x: AWSTimestamp!
	y: Int!
}

type Mutation {
	updateData: ChartData
}

type Query {
	getChartData: ChartData
}

type Subscription {
	dataUpdatedSubscription: ChartData
		@aws_subscribe(mutations: ["updateData"])
}

schema {
	query: Query
	mutation: Mutation
	subscription: Subscription
}

Create resolver(s) using Datasource of your choice and attach to updateData and getChartData.

Config

Create a file config/config.js using the sample config/example.config.js and update with GraphQL endpoint, region and API Key.

Run the app

npm run start

About

A sample webpage to render Real Time chart with AppSyncClient


Languages

Language:JavaScript 69.7%Language:HTML 30.3%