graphql-engine/community/boilerplates/event-triggers/aws-lambda/nodejs6/mutation
Anon Ray a21f6cd648 introduce v1/graphql (fix #1368) (#2064)
Changes compared to `/v1alpha1/graphql`

* Changed all graphql responses in **/v1/graphql** endpoint to be 200. All graphql clients expect responses to be HTTP 200. Non-200 responses are considered transport layer errors. 

* Errors in http and websocket layer are now consistent and have similar structure.
2019-05-10 11:35:10 +05:30
..
.gitignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
index.js introduce v1/graphql (fix #1368) (#2064) 2019-05-10 11:35:10 +05:30
package-lock.json refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
package.json refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
README.md rename access-key to admin-secret (close #1347) (#1540) 2019-02-14 15:07:47 +05:30

Setup tables

  1. Create the table using the console:
Table name: notes

Columns:
id: Integer auto-increment
note: Text

Table name: note_revision

Columns:
id: Integer auto-increment
note: Text
note_id: Integer (foreign key to notes.id)
update_at: Timestamp, default `now()`

Setup AWS Lambda

Create a lambda function in AWS. This will be our webhook.

  1. In this folder, run npm install
  2. Then create a zip: zip -r hge-mutation.zip .
  3. Create a Lambda function.
  4. Select Node.js 6 as the runtime.
  5. Select "start from scratch".
  6. Add API gateway as a trigger.
  7. Add an API to API gateway.
  8. Upload the zip from previous step. The handler function of your lambda will be index.handler.
  9. Add the following enviroment variables in your lambda config:
    1. ADMIN_SECRET: this is the admin secret key you configured when you setup HGE.
    2. HGE_ENDPOINT: the URL on which you HGE instance is running.

Add the trigger in Hasura GraphQL

  1. In events tab, add a trigger
  2. Select all insert, update, delete operations for the trigger.
  3. Paste the API endpoint of your AWS lambda as the webhook.