We will be learning how to integrate Appsyn with an Angular 7 App using Amplify. In the previous tutorial, I have shared some insights on Appsync subscriptions. Let's get started.
Please fork the complete project from my Github.
- Refer to the amplify generic instructions mentioned in this article.
- In the
aws-exports.jsinclude the Appsync configuration as well.
Note: We have included functionality to unsubscribe subscribed function.
Queries on Vehicle
- To Create a Vehicle.
2. To Query a Vehicle.
3. To update a Vehicle Location.
Initially when the App loads, we have the last known data of CAR4, in the GraphQL Query Section. When we push updates via mutate-function (updateVehicleLocation), the data is reflected in the GraphQL Subscribed Data Section. When you unsubscribe, the data is no longer updated in the Subscribed Data section.
Note: To verify that you are only subscribed to CAR4 updateLocation changes, try pushing mutate changes for CAR1 and see if you are receiving those updates. Ideally, you won’t.
You can deploy this web app in AWS Cloudfront. The instructions will be similar to this: Deploying Angular App in Cloudfront with SSL.
Found it Interesting?
Please show your support by 👏.