cloudflare/vinext
Publicmirrored from https://github.com/cloudflare/vinextAvailable
examples/realworld-api-rest/pages/api/users.ts
13lines · modecode
| 1 | import type { NextApiRequest, NextApiResponse } from "next"; |
| 2 | import type { User } from "../../interfaces"; |
| 3 | |
| 4 | // Fake users data |
| 5 | const users: User[] = [{ id: 1 }, { id: 2 }, { id: 3 }]; |
| 6 | |
| 7 | export default function handler( |
| 8 | _req: NextApiRequest, |
| 9 | res: NextApiResponse<User[]>, |
| 10 | ) { |
| 11 | // Get data from your database |
| 12 | res.status(200).json(users); |
| 13 | } |
| 14 | |