nles / micro-airtable-api

Quickly make an API from Airtable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

micro-airtable-api

Quickly make an API from an Airtable. Use it as a database or CMS without any hassle.

🚧 This project has not been thoroughly tested. Use at your own risk!

Setup

To use now and deploy with a single command:

$ now rosszurowski/micro-airtable-api -e AIRTABLE_BASE_ID=asdf123 -e AIRTABLE_API_KEY=xyz123

> Deployment complete! https://micro-airtable-api-asfdasdf.now.sh

You can find your Base ID in the Airtable API docs and API key in your Airtable account settings.

Once deployed, you can load your data:

https://micro-airtable-api-asdasd.now.sh/v0/Table

Read below for all configurable options.

Details

Airtable offers an API for your tables, but using it on the client-side exposes your API key, giving anyone read-write permissions to your table.

micro-airtable-api proxies an Airtable API, letting you hide your key and optionally mark an API as read-only, making Airtable a cheap-and-easy CMS for blogs and sites.

Configuration

micro-airtable-api supports a few different options through environment variables for easy deployment.

AIRTABLE_BASE_ID (required)

The Base ID of the Airtable you want to connect to. You can find this in your Airtable API docs.

AIRTABLE_API_KEY (required)

Your personal account API key. You can find this in your account settings.

READ_ONLY

A shortcut flag to restrict the API to only GET requests. Users of the API will be able to list all records and individual records, but not create, update, or delete.

ALLOWED_METHODS

A comma-separated list of allowed HTTP methods for this API. Use this to restrict how users can interact with your API. For example, allow creating new records but not deleting by passing in a string without the delete method: ALLOWED_METHODS=GET,POST,PATCH.

The OPTIONS method is always allowed for CORS purposes.

The READ_ONLY flag is a shortcut to set ALLOWED_METHODS=GET.

Defaults to every method supported by Airtable: GET,POST,PATCH,DELETE.

PORT

Sets the port for the local server. Defaults to 3000.

Todo

License

Copyright ©️ 2017 Ross Zurowski, licensed under the MIT License. See LICENSE.md for more information.

About

Quickly make an API from Airtable

License:MIT License


Languages

Language:JavaScript 100.0%