Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.get('/cameras', function(req,res) {
- var username;
- res.locals.login ? username = req.user.username : username = null;
- res.render('shop/cameras',{ csrfToken: req.csrfToken(), username: username});
- });
- router.post('/cameras', function(req, res) {
- console.log(req.body);
- Listing.find({description:{'$regex' : req.body.searchterm, '$options' : 'i'}}, function(err, listings) {
- console.log(JSON.stringify({listings: listings}));
- res.json(JSON.stringify({listings: listings}));
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement