next-app-boilerplate/pages/api/hello.ts

13 lines
322 B
TypeScript
Raw Normal View History

2022-02-12 23:07:11 +01:00
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
2022-03-24 01:44:55 +01:00
interface Data {
2022-02-12 23:07:11 +01:00
name: string
}
2022-03-24 01:44:55 +01:00
const handler = (req: NextApiRequest, res: NextApiResponse<Data>): void => {
2022-02-12 23:07:11 +01:00
res.status(200).json({ name: 'John Doe' })
}
2022-03-24 01:44:55 +01:00
export default handler