1.8.7 • Published 4 days ago

@ttoss/aws-appsync-nodejs v1.8.7

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

@ttoss/aws-appsync-nodejs

This package implements a AWS AppSync client for Node.js. We've followed the AWS Amplify example to create this package.

Installation

pnpm add @ttoss/aws-appsync-nodejs

Quickstart

import { appSyncClient } from '@ttoss/aws-appsync-nodejs';

appSyncClient.setConfig({
  endpoint: 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',
  apiKey: 'da2-xxxxxxxxxxxxxxxxxxxxxxxxxx',
});

const query = /* GraphQL */ `
  query user($id: ID!) {
    user(id: $id) {
      id
      name
    }
  }
`;

appSyncClient.query(query, { id: '1' }).then((result) => {
  console.log(result);
});

Config

You need to configure the client with endpoint (required), apiKey (optional) and credentials (optional).

  1. If you don't provide apiKey or credentials, the client will try to use the AWS credentials from the environment variables of your system—local computer, AWS Lambda, EC2.
appSyncClient.setConfig({
  endpoint: 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',
});
  1. If you provide apiKey, the client will use the API key to authenticate.
appSyncClient.setConfig({
  endpoint: 'https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql',
  apiKey: 'da2-xxxxxxxxxxxxxxxxxxxxxxxxxx',
});
  1. If you provide credentials, the client will use the credentials to authenticate.
appSyncClient.setConfig({
  endpoint,
  credentials: {
    accessKeyId: // access key id,
    secretAccessKey: // secret access key,
    sessionToken: // optional session token,
  },
});

If you provide the default endpoint (https://xxxxxx.appsync-api.us-east-1.amazonaws.com/graphql), the client will retrieve the region from the endpoint. If you provide the endpoint with the custom domain (https://custom-domain.com), you need to provide the region as well.

appSyncClient.setConfig({
  endpoint: 'https://custom-domain.com',
  region: 'us-east-1',
  credentials: {
    accessKeyId: // access key id,
    secretAccessKey: // secret access key,
    sessionToken: // optional session token,
  },
});
1.8.7

4 days ago

1.8.6

18 days ago

1.8.5

25 days ago

1.8.4

1 month ago

1.8.3

1 month ago

1.8.2

1 month ago

1.8.1

3 months ago

1.8.0

4 months ago

1.7.4

5 months ago

1.7.3

6 months ago

1.7.2

6 months ago

1.7.1

6 months ago

1.7.0

7 months ago

1.6.6

9 months ago

1.6.5

10 months ago

1.6.4

11 months ago

1.6.3

12 months ago

1.6.1

12 months ago

1.6.0

1 year ago

1.5.10

1 year ago

1.5.9

1 year ago

1.5.5

1 year ago

1.5.4

1 year ago

1.5.3

1 year ago

1.5.8

1 year ago

1.5.7

1 year ago

1.5.6

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago