I am getting the Allocation of Resources Without Limits or Throttling errors when I am testing my code. I can't understand how to implement this Throttling with my route.
I have tried with middleware but the same issue with when I test it with snyk.
This endpoint handler performs an operation and does not use a rate-limiting mechanism. It may enable the attackers to perform Denial-of-service attacks. Consider using a rate-limiting middleware such as express-limit.
can anyone explain how to implement it with my route?
here is the endpoint code.
edit: async (req, res) => {
const editCatagoryId = req.params.slug;
try {
const category = await Category.findOne({ where: { slug: editCatagoryId } });
if(category) {
res.render('admin/category/edit', { title: 'Category Edit', category });
} else {
req.flash('error', 'Something Wrong with Category or Not found !');
return res.status(404).redirect('back');
}
} catch (err) {
req.flash('error', 'Something Wrong with Editing Category !');
return res.status(302).render('back');
}
},