Setup tables
- Create table:
notes:
id: int
note: text
Setup Cloud Function
- Add
netlify.toml
to your Netlify root directory - Rename
.netlifygitignore
to.gitignore
to your Netlify root directory - (alt) Alternatively edit your pre-existing
.gitignore
to ignore your functions folder - Add the following scripts to your
package.json
:
// functions is the name of your functions folder
// if you are using a different name change it
"scripts": {
"lambda-serve": "netlify-lambda serve functions",
"lambda-build": "netlify-lambda build functions"
}
- Add the file
index.js
to your functions folder
Running locally
netlify-lambda serve functions
Build
netlify-lambda build functions
Add the trigger in Hasura GraphQL
- In events tab, add a trigger
- Select all insert, update, delete operations for the trigger.
- Paste your function URL as the webhook. (eg: http://host.docker.internal:9000/index)