I am trying to make a create FormData to submit as a POST within NextJs api route
Dir: /pages/api/file.ts
import { NextApiRequest, NextApiResponse } from 'next'
export const config = {
api: {
bodyParser: false
}
}
export default async (req: NextApiRequest, res: NextApiResponse) => {
const formdata = new FormData()
....
Can someone please explain why this throws the error:
ReferenceError: FormData is not defined
How can this be fixed?