Skip to content

Package that makes easier the graphql requests to appsync when the authentication method is Cognito user pools

License

Notifications You must be signed in to change notification settings

gdaguilarc/appsync-cognito-query

Repository files navigation

appsync-cognito-query

Node.js CI Coverage Status

Package that makes easier the graphql requests to appsync when the authentication method is Cognito user pools

Getting Started

After installing the package, import the query manager as any package other package like this:

const acq = require('appsync-cognito-query');

Then we need to init the query manager and set the endpoint.

const manager = acq.init(YOUR_APPSYNC_ENDPOINT);

Then we can access the main functions of the manager. For a mutation query for example first we need to authenticate and then we can use graphql with the query method:

await manager.authenticateUser(YOUR_USER_POOL_ID, YOUR_CLIENT_ID, COGNITO_USER_USERNAME, COGNITO_USER_PASSWORD);

const mutation = `
        mutation CreateMessage {
          createMessage(input: {
            messageChatId:"5523456789",
            id: "12345",
            content:"Message content",
            createdAt: "2019-07-01T20:26:57.761Z",
            type: "TEXT"
          }) {
          id
          content
          type
          createdAt
      }
}`;

await manager.query(mutation);

Installing

This NPM package is installed such as any other one with the next command:

npm install appsync-cognito-query

Running the tests

npm run test

Built With

Contributing

I encourage and support the open source code so I will be very happy to receive contributions.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

About

Package that makes easier the graphql requests to appsync when the authentication method is Cognito user pools

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published