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

13 lines
322 B
TypeScript

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
interface Data {
name: string
}
const handler = (req: NextApiRequest, res: NextApiResponse<Data>): void => {
res.status(200).json({ name: 'John Doe' })
}
export default handler