server/controllers/productController.js
Function createProduct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createProduct(req, res) {
const { errors, isValid } = productsValidation.validateProductInput(req.body);
// Check validation
if (!isValid) {
return res.status(400).json(errors);
Avoid too many return
statements within this function. Open
Open
return res.json({ message: 'Unable to delete product.' });