diff --git a/middleware/Vegetables.js b/middleware/Vegetables.js index 8661d34..febeeab 100644 --- a/middleware/Vegetables.js +++ b/middleware/Vegetables.js @@ -138,6 +138,10 @@ class Vegetables { } static searchAll (req, callback) { + if (!req.query.q || req.query.q.length < 3) { + callback(new Error('Minimum 3 letters'), 406) + return false + } vegetables.findAndCountAll({ where: { name: {