Instructor: Go to airtable.com and create or sign into an account. Go to your account and generate an API key. Select and copy this in your clipboard. Then, I'm going to create a file called .env and in all caps name and airtable_api_key. The name is important. Set that equal to the key that you copied.
To use the .env file in node, I'm going to install .env. In my package JSON, I'll add some scripts. I'll say that my start script is node and tell it to require with -r.env/config and start up in index JS file, which will create right here.
This line is telling .env to bring these defined environment variables into this script. Now, we can add the Airtable API. You can find it by clicking on Airtable API here. I want to use the applicant tracking base. Clicking on that gives us this key or ID to the base.
I'm going to copy that. Then, I'll require Airtable, so Airtable is require Airtable, and our base is airtable.base, and paste in that ID. Also note, behind the scenes that Airtable is bringing in this API key, because the .env has assigned it to this environment variable being brought in here.
Now if you look at the base when I click open base, we want to get this base of applicants, so we'll say applicants is base and pass in applicants. Then on my applicants, I can select a view of...Right here, you can see all applicants.
I'll just type in all applicants. I'll call this all. Now, I can say all first page. Then, pass in a function with an error and the records of the first page. If it errors out, you could handle in with this. We're going to get the records. The first page, we'll have the first one hundred records, we only have three.
In these records, I want to get the name. I'm going to say the names or records.map. Get each record and say record get name. Then, I can simply console log out all the names. Hit save there, which will reformat a little bit.
Then, clear this out into say yarn start. You'll see Chippy the potato, Queen Elizabeth II, and inaudible . We brought in each name of then all applicants view inside of the applicants base, inside of the applicant tracking base.