-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdatabase.js
42 lines (32 loc) · 985 Bytes
/
database.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const base = require('airtable').base('appS9WOamZi9CH8NO');
module.exports.listUsers = async () => {
base('catleadertable').select({
}).eachPage(function page(records, fetchNextPage) {
// This function (`page`) will get called for each page of records.
records.forEach(function(record) {
console.log('Retrieved', record.fields.Name,record.fields.Score);
});
// 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); return; }
});
}
base('catleadertable').create([
{
"fields": {
"Name": "lexi",
"Score": -100
}
},
], function(err, records) {
if (err) {
console.error(err);
return;
}
records.forEach(function (record) {
console.log(record.getId());
});
});``