Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
micro-airtable-api
Advanced tools
[![Build Status](https://badgen.net/travis/rosszurowski/micro-airtable-api)](https://travis-ci.com/rosszurowski/micro-airtable-api)
Quickly make an API from an Airtable. Use it as a database or CMS without any hassle.
Airtable offers a great API, but using it on the client-side exposes your API key, giving anyone read-write permissions to your data. micro-airtable-api
proxies an Airtable API, hiding your API key and letting you control access (eg. marking an API as read-only).
Use Airtable as a cheap-and-easy CMS for simple blogs and sites :tada:
:construction: This project has not been thoroughly tested. Use at your own risk!
The simplest way to get started with your own Airtable proxy is via now
. Setup 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
Once deployed, you can read or edit your data at:
https://micro-airtable-api-asdasd.now.sh/v0/TableName
To update to a new version with potential bugfixes, all you have to do is run the now
command again and change the URL you call in your app!
If you'd like to run a proxy on a different service, you can use the micro-airtable-api
command-line. Install the package globally and run it:
$ npm i -g micro-airtable-api
$ AIRTABLE_BASE_ID=asdf123 AIRTABLE_API_KEY=xyz123 micro-airtable-api
> micro-airtable-api listening on http://localhost:3000
For more advanced configuration or to integrate with an existing http or express server, you can also install the package locally and pass the handler into your webserver:
$ npm i micro-airtable-api
const http = require('http');
const createAirtableProxy = require('micro-airtable-api');
const config = {
airtableApiKey: 'YourApiKey',
airtableBaseId: 'YourBaseId',
};
const server = http.createServer(createAirtableProxy(config));
You can find your Base ID in the Airtable API docs and API key in your Airtable account settings.
Read below for all configurable options.
micro-airtable-api
is configurable both through the JS API and the CLI.
const http = require('http');
const createAirtableProxy = require('micro-airtable-api');
const config = {};
http.createServer(createAirtableProxy(config));
config.airtableBaseId
(required)The Base ID of the Airtable you want to connect to. You can find this in your Airtable API docs.
config.airtableApiKey
(required)Your personal account API key. You can find this in your account settings.
config.allowedMethods
An array of HTTP methods supported by the API. Use this to restrict how users can interact with your API. Defaults to all methods.
This maps directly to operations on Airtable:
GET
allows reading lists of records or individual recordsPOST
allows creating new recordsPATCH
allows updating existing recordsDELETE
allows removing records.To create a read-only API, to use as a CMS:
createAirtableProxy({
airtableBaseId: '...',
airtableApiKeyId: '...',
allowedMethods: ['GET'],
});
To create a write-only API, to use for collecting survey responses:
// A write-only API (eg. surveys)
createAirtableProxy({
airtableBaseId: '...',
airtableApiKeyId: '...',
allowedMethods: ['POST'],
});
You can set table-specific permissions by passing in an object with table names as the keys.
If you were setting up a blog through Airtable, you could do the following:
createAirtableProxy({
airtableBaseId: '...',
airtableApiKeyId: '...',
allowedMethods: {
'Blog Posts': ['GET'],
'Blog Comments': ['POST', 'PATCH', 'DELETE'],
},
});
Note, the OPTIONS
method is always allowed for CORS purposes.
The CLI exposes the above configuration options through environment variables for easy deployment.
$ AIRTABLE_BASE_ID=asdf123 AIRTABLE_API_KEY=xyz123 micro-airtable-api
AIRTABLE_BASE_ID
(required) Same as config.airtableBaseId
aboveAIRTABLE_API_KEY
(required) Same as config.airtableApiKey
aboveALLOWED_METHODS
Similar to config.allowedMethods
above, except a comma-separated list instead of an array. For example, allow creating new records but not deleting by passing in a string without the delete method: ALLOWED_METHODS=GET,POST,PATCH
. The CLI does not support table-specific permissions. Use the JS API if this is something you need.READ_ONLY
A shortcut variable to restrict the API to only GET
requests. Equivalent to ALLOWED_METHODS=GET
. Users of the API will be able to list all records and individual records, but not create, update, or delete.PORT
Sets the port for the local server. Defaults to 3000
.Issues and PRs are welcome! If you'd like to contribute code, check out our guide on how to contribute.
FAQs
[![Build Status](https://badgen.net/travis/rosszurowski/micro-airtable-api)](https://travis-ci.com/rosszurowski/micro-airtable-api)
The npm package micro-airtable-api receives a total of 0 weekly downloads. As such, micro-airtable-api popularity was classified as not popular.
We found that micro-airtable-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.