2 errors:
unreadable client response
adding in the cart more than product amount if the product is already in the cart
add:
// -- Validate the ID format
if (!mongoose.Types.ObjectId.isValid(id)) {
return next(new HttpError("Invalid customer ID format", 400));
}
2 errors: unreadable client response adding in the cart more than product amount if the product is already in the cart add: // -- Validate the ID format if (!mongoose.Types.ObjectId.isValid(id)) { return next(new HttpError("Invalid customer ID format", 400)); }