Created as a part of a prototype for the Summer of Shipping Showcase.
Using Gui Talarico's tutorial Using Airtable as a Content Backend as well as Kent C. Dodd's Super simple start to serverless, this is a serverless proxy backend that interacts with Airtable's API to retrieve data. It utilizes Netlify's Functions which simplify setting up AWS Lambda functions, as well as AWS Cloudfront CDN to mitigate Airtable's API rate limits.
If you would like to test it out, send a GET request to any of the following URLs:
- https://sleepy-easley-48bf25.netlify.app/.netlify/functions/projects
- https://sleepy-easley-48bf25.netlify.app/.netlify/functions/persons
You will need to have either npm
or yarn
installed, a Netlify account, and the Netlify CLI which can be installed with the following command:
npm install netlify-cli -g
OR yarn global add netlify-cli
Additionally, you will need to have an Airbase account and API key for a base. To have this run successfully, you will want to have a base with two tables, each named projects
and persons
. Take note of the ID of your base which can be found in your unique Airtable API documentation.
- Fork this repository and clone it to your local machine.
- In both
project.js
andpersons.js
, change the string in line 8 to the base ID provided by your Airtable documentation. - Gui Talarico's tutorial provides instructions on how to set up an AWS Cloudfront proxy cache toward the end of the article. Follow the instructions.
- Go to your Netlify sites and create a new site from Git, using your newly forked repository. Do not configure the settings with a build command or publish directory.
- After the site has been deployed, go to Site Settings > Build & deploy > Environment and create new environment variables
AIRTABLE_KEY
,AIRTABLE_BASE
, andCLOUDFRONT_URL
with your Airtable API key, Airtable Base ID and Cloudfront Domain Name generated by your new Cloudfront Distibution (e.g. example.cloudfront.net). Re-deploy. - In the command line, type in
netlify login
to authenticate and obtain an access token. - Afterwards, use
netlify init
to connect your repository. - Run the build locally using
netlify build
- To test, go to either of the following URLs: