This is the demo code from my talk about Gatsby Functions at Gatsby Fall Camp 2021.
It demos how to charge money for time traveling using Stripe, and then letting the travellers know if they found the princess or not using SendGrid.
Who is this princess, why time travelling? Sign up for the backstory via email.
Get notified about up-coming plugins, workshops, streams and future articles to help you get the most out of Gatsby by signing up for emails from yours truly.
-
Add env variables
Copy/paste
.env.example
into.env.development
and add your own values. -
Start developing.
Navigate into your new site’s directory and start it up.
npm run develop
-
Open the code and start customizing!
Your site is now running at http://localhost:8000!
Edit
src/pages/index.js
to change the form, andsrc/pages/sucess
to change the sucess page.The functions are running at
Edit
src/api/stripe-webhook.js
and/orsrc/api/time-travel.js
to change them. -
Learn more from Gatsby