-
Get Access Tokens for Airtable and Sendgrid.
This starter has examples from both Airtable and Sendgrid for posting forms and for sending emails. There are 3 environment variable you'll need to add your project:
GATSBY_SENDGRID_API_KEY
: Get sendgrid API keysGATSBY_SENDGRID_API_EMAIL
: Your authorized email addressGATSBY_AIRTABLE_KEY
: Get an Airtable API Key pageGATSBY_AIRTABLE_DB
: Select a Base on the API docs to get the table id
You'll want to add these as environment variables when deploying to Gatsby Cloud. Don't forget to add them to the Preview variables if you plan to add a CMS preview integration.
-
Start developing.
To get started, run
yarn
to add all necessary packages.When developing locally, you'll want to include the ENV variables inline with your
gatsby develop
command (i.e.GATSBY_SENDGRID_API_KEY={your_key_here} gatsby develop
).cd gatsby-functions-starter-alpha yarn run develop
-
Open the code and start customizing!
Your site is now running at http://localhost:8000! You can use the UI on the index page to test the functions or directly access them at http://localhost:8000/api/airtable and http://localhost:8000/api/sendgrid
Edit
src/pages/index.js
to see your site update in real-time! -
Deploy