I am trying to implement a function where a file will be uploaded to the public folder of the nextjs app using next-connect. But getting a typescript error -
This expression is not callable. Type 'typeof import("d:/directory/file-upload/node_modules/next-connect/dist/types/index")' has no call signatures.
Api Codes in - api/fileUpload
import nextConnect from "next-connect";
import { NextApiRequest, NextApiResponse } from "next";
const apiRoute = nextConnect({
onError(error: { message: any }, req: NextApiRequest, res: NextApiResponse) {
res
.status(501)
.json({ error: `Sorry something Happened! ${error.message}` });
},
onNoMatch(req: NextApiRequest, res: NextApiResponse) {
res.status(405).json({ error: `Method '${req.method}' Not Allowed` });
}
});
I am getting the mentioned error on the 3no line.
I was following this link.
Can Anyone help me what am I missing here?