Hi,
The endpoint is running locally at localhost:3000/api/link-items
and it is a POST call.
This is the POST handler
/**
* handle POST
* @param req
* @param res
*/
const addNewLinkItem = async (req: NextApiRequest, res: NextApiResponse, user: Claims) => {
const linkItem = req.body as LinkItem;
try {
await prisma.linkItem.create({
data: linkItem,
});
res.status(200).send("Link item created");
} catch (error) {
console.error(error);
res.status(500).send("An error occurred creating link item");
}
};
And this is the export
export default withApiAuthRequired(requestHandler);
where requestHandler
calls an handler based on the request type (POST in this case).