Skip to content

Instantly share code, notes, and snippets.

@brandonchadlange
Created September 20, 2022 06:08
Show Gist options
  • Save brandonchadlange/136dadf095dd214f689f0fe9d49f8f40 to your computer and use it in GitHub Desktop.
Save brandonchadlange/136dadf095dd214f689f0fe9d49f8f40 to your computer and use it in GitHub Desktop.
Next.js API route
import type { NextApiRequest, NextApiResponse } from 'next'
type Data = {
name: string
}
export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment