We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f825953 commit 9ac37dbCopy full SHA for 9ac37db
api/ok.js
@@ -1,8 +1,13 @@
1
-// import { getTop10Records } from './db/index.js'
+import { getTop10Records } from './db/index.js'
2
3
export const config = { runtime: 'nodejs' }
4
5
-export default function handler(_req, res) {
6
- // const records = await getTop10Records()
7
- res.json({ message: 'Hello World' })
+export default async function handler(_req, res) {
+ try {
+ const records = await getTop10Records()
8
+ res.json(records)
9
+ } catch (error) {
10
+ console.error(error)
11
+ res.status(500).json({ message: 'Internal server error' })
12
+ }
13
}
0 commit comments