Package Exports
- appsync-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (appsync-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Appsync Client
A lightweight Appsync client that signs requests for you - perfect for running on Lambdas or servers. This module has not been tested for use on the browser.
When using tree-shaking, the impact on your bundle size is just a few kb.
Use
import AppsyncClient from "appsync-client";
async function getTodo() {
// Create a client
const client = new AppsyncClient({
// Required
apiUrl: "https://xxx.appsync-api.xx-xxxx-x.amazonaws.com/graphql",
// Optional - these will default to process.env values (e.g. the IAM
// role of the Lambda)
accessKeyId: "",
secretAccessKey: "",
sessionToken: ""
});
// Query for TODOS
const res = await client.request({
// The query string - can be manually written, or you can use amplify
// codegen to create these
query: `query Todo(id: $id) {
getTodo(id: $id) {
id
title
description
}
}`,
// Variables to replace (here we are replacing $id with "todoId")
variables: {
id: "todoId"
}
);
}Checklist
| CD Feature | Provided |
|---|---|
| ✅ | Typescript |
| ✅ | Linting (AirBnB + Prettier) |
| ✅ | Unit tests (Jest) |
| ✅ | 100% test coverage |
| ✅ | Github Continuous Deployment |
Built by Skyhook
This module is contributed by the team at Skyhook.