Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

next api typescript

import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
  name: string
}

export default (req: NextApiRequest, res: NextApiResponse<Data>) => {
  res.status(200).json({ name: 'John Doe' })
}
Source by nextjs.org #
 
PREVIOUS NEXT
Tagged: #api #typescript
ADD COMMENT
Topic
Name
7+3 =