graphql-engine/community/boilerplates/event-triggers/azure-functions/nodejs/mutation
nizar-m f83a8e591f rename access-key to admin-secret (close #1347) (#1540)
Rename the admin secret key header used to access GraphQL engine from X-Hasura-Access-Key to X-Hasura-Admin-Secret.

Server CLI and console all support the older flag but marks it as deprecated.
2019-02-14 15:07:47 +05:30
..
HTTPTrigger rename access-key to admin-secret (close #1347) (#1540) 2019-02-14 15:07:47 +05:30
.gitignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
host.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 table:
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 Cloud Function

  1. Run the following commands to deploy:
az group create --name 'my-functions-group' --location southindia

az storage account create --name 'myfunctionsstorage' --location southindia --resource-group 'my-functions-group' --sku Standard_LRS

az functionapp create --name 'myfunctionsapp' --storage-account 'myfunctionsstorage' --resource-group 'my-functions-group' --consumption-plan-location southindia

func azure login
func azure subscriptions set 'Free Trial'
func azure functionapp publish 'myfunctionsapp'
  1. Set Environment variables ADMIN_SECRET and HGE_ENDPOINT
  2. Add a X-Function-Key header if Authorization level is enabled

Running locally

func host start

Check Logs

func azure functionapp logstream 'myfunctionsapp'

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 your function URL as the webhook.