Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
router.get('/apps/', function (req, res, next) {
if (!req.query.suggest) {
return next();
}
const toJSON = (term) => ({
term,
url: buildUrl(req, '/apps/') + '?' + qs.stringify({q: term})
});
gplay.suggest({term: req.query.suggest})
.then((terms) => terms.map(toJSON))
.then(toList)
.then(res.json.bind(res))
.catch(next);
});