Skip to content

Instantly share code, notes, and snippets.

@tim-phillips
Forked from benoror/airtable-proxy.js
Created April 1, 2018 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-phillips/0c85bf17323f6412615e992de1f9d6ac to your computer and use it in GitHub Desktop.
Save tim-phillips/0c85bf17323f6412615e992de1f9d6ac to your computer and use it in GitHub Desktop.
Node.js Airtable API Proxy
var express = require('express');
var proxy = require('http-proxy-middleware');
var options = {
logLevel: 'debug',
target: 'https://api.airtable.com/v0/' + process.env.APP_ID,
changeOrigin: true,
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer ' + process.env.API_KEY
},
pathRewrite: {
'^/api' : ''
},
secure: false,
ssl: {
rejectUnauthorized: false
}
};
var apiProxy = proxy(options);
var app = express();
app.use('/api', apiProxy);
var server = app.listen(process.env.PORT || 3000, function(){
console.log('Listening on port ' + server.address().port);
});
module.exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment