Skip to content

Commit 9ac37db

Browse files
committed
feat(e2e): enabled integration with db
1 parent f825953 commit 9ac37db

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

api/ok.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
// import { getTop10Records } from './db/index.js'
1+
import { getTop10Records } from './db/index.js'
22

33
export const config = { runtime: 'nodejs' }
44

5-
export default function handler(_req, res) {
6-
// const records = await getTop10Records()
7-
res.json({ message: 'Hello World' })
5+
export default async function handler(_req, res) {
6+
try {
7+
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+
}
813
}

0 commit comments

Comments
 (0)