Created
March 28, 2021 02:37
-
-
Save TRahulSam1997/acc21159efe7135d14301e3b1c3ea73f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { table, minifyRecords } from './utils/airtable'; | |
export default async (req, res) => { | |
try { | |
const records = await table.select({}).firstPage(); | |
const minifiedRecords = minifyRecords(records); | |
res.statusCode = 200; | |
res.json(minifiedRecords); | |
} catch (err) { | |
res.statusCode = 500; | |
res.json({ msg: 'Something went wrong' }); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment