text: const Airtable = require("airtable");
  
  exports.handler = (event, context, callback) => {
    const { API_URL, API_CLIENT_ID, API_KEY } = process.env;
  
    Airtable.configure({
      endpointUrl: API_URL,
      apiKey: API_KEY
    });
  
    const base = Airtable.base(API_CLIENT_ID);
    const data = [];
  
    base("museums")
      .select({
        // Selecting the first 100 records in Grid view:
        maxRecords: 100,
        view: "Grid view"
      })
      .eachPage(
        function page(records, fetchNextPage) {
          // This function (`page`) will get called for each page of records.
  
          records.forEach(function(record) {
            data.push(record);
          });
  
          // To fetch the next page of records, call `fetchNextPage`.
          // If there are more records, `page` will get called again.
          // If there are no more records, `done` will get called.
          fetchNextPage();
        },
        function done(err) {
          if (err) {
            console.error(err);
          } else {
            const body = JSON.stringify({ records: data });
            const response = {
              statusCode: 200,
              body: body,
              headers: {
                "content-type": "application/json",
                "cache-control": "Cache-Control: max-age=60, public"
              }
            };
            callback(null, response);
          }
        }
      );
  };
  