Open History to see the last commit
1import type { NextApiRequest, NextApiResponse } from 'next'
2β
3export default async (req: NextApiRequest, res: NextApiResponse) => {
4 const page =
5 typeof req.query.page === 'string' ? parseInt(req.query.page) || 0 : 0
6β
7 const pageSize = 10
8β
9 const projects = Array(pageSize)
10 .fill(0)
11 .map((_, i) => {
12 const id = page * pageSize + (i + 1)
13 return {
14 name: 'Project ' + id,
15 id,
16 }
17 })
18β
19 await new Promise((r) => setTimeout(r, 1000))
20β
21 res.json({ projects, hasMore: page < 9 })
22}