Create a dotenv file
First you'll want to create a .env file
AIRTABLE_API_KEY=xxxxxxxxxx
AIRTABLE_BASE_ID=appxxxxxx
AIRTABLE_TABLE_NAME=base-1
Install dotenv
Once you have this created you can use it by installing dotenv
npm -i dotenv
Set up dotenv in airtable.js
require('dotenv').config();
var Airtable = require('airtable');
var base = new Airtable({ apiKey: process.env.AIRTABLE_API_KEY }).base(
process.env.AIRTABLE_BASE_ID
);
const table = base(process.env.AIRTABLE_TABLE_NAME);
module.exports = { table };
Top comments (0)