Created
March 24, 2015 14:27
-
-
Save alexpersian/4728ba1ff7b6a9a1bab2 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
app.get('/api/posts', function(req, res) { | |
Post.find(function(err, posts) { | |
// if there is an error retrieving, send the error | |
// nothing after res.send(err) will execute if there is one | |
if (err) { | |
res.send(err); | |
} | |
res.json(posts); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment