Last active
February 9, 2018 01:54
-
-
Save waterswv/0855d42b4a4571a9995b959bc4ff9965 to your computer and use it in GitHub Desktop.
API get request by slug
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('/:id', function(req, res, next) { | |
db.Post.findById(req.params.post_id, function(err, mainPost) { | |
if (err){ | |
console.log('Error', err); | |
} |
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('/:slug', function(req, res, next) { | |
db.Post.findOne({'slug': req.params.slug}, function(err, mainPost) { | |
if (err){ | |
console.log('Error', err); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment