Created
January 22, 2015 21:41
-
-
Save ZachMoreno/8ea621015c8fc7502520 to your computer and use it in GitHub Desktop.
This file contains 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.route('/api/categories/:categoryID') | |
.get(function(req, res) { | |
// query | |
connection.query('SELECT listers.lister_id, listers.listing_name, listers.city, listing_categories.category_name FROM listing_categories INNER JOIN listings ON listing_categories.listing_category_id = listings.listing_category_id JOIN listers ON listings.lister_id = listers.lister_id WHERE listings.listing_category_id = ' + req.param('categoryID'), function(err, rows, fields) { | |
if(err) { | |
res.send(err); | |
console.log(err); | |
connection.end(); | |
} else { | |
res.send(rows); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment