Skip to content

Instantly share code, notes, and snippets.

Created December 24, 2015 03:13
Show Gist options
  • Save anonymous/69802ee3d24ff19f3ee0 to your computer and use it in GitHub Desktop.
Save anonymous/69802ee3d24ff19f3ee0 to your computer and use it in GitHub Desktop.
router.post('/search', function(req, res, next) {
//Im confused right now.
});
router.get('/search?q=search_term', function(req, res, next) {
Product.search(
{
query_string:
{ query: req.query.q }
} , function(err, results) {
if (err) return next(err);
var data = results.hits.hits.map(function(hit) {
return hit;
});
return res.render('main/search-results', { data: data });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment