Created
December 16, 2014 02:36
-
-
Save troygoode/57ecb59384df014ed927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get('/', function (req, res, next) { | |
// maybe validate that some filter criteria are sent? | |
debug('QUERY', req.query.q); | |
if (!req.query.q || req.query.q.length < 3) { | |
return next(new Error("'q' must be three or more characters")); | |
} | |
var results = Leads.search(req.query.q || '').then(function (results) { | |
debug('number of leads: ' + results.length); | |
res.json(results); | |
}).catch(next); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment