Skip to content

Instantly share code, notes, and snippets.

@knownasilya
Created July 29, 2013 15:03
Show Gist options
  • Save knownasilya/6104964 to your computer and use it in GitHub Desktop.
Save knownasilya/6104964 to your computer and use it in GitHub Desktop.
api addresses
app.get(relativeRoute('/api/addresses'), function (req, res) {
var island = req.param('island'),
result = {};
if (island) {
Address.find({ island: island, existing_address: { $nin: ['', ' '] } }, function (err, addresses) {
if (err) {
console.log(err);
res.send(404);
return;
}
result['addresses'] = addresses;
res.json(200, result);
});
}
else {
res.send(404);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment