Created
March 1, 2017 22:20
-
-
Save gunnigylfa/9574866380b74501a10459ecdbc955bd to your computer and use it in GitHub Desktop.
A GET resource for our hero collection
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
// GET '/v1/heroes' Get (Read) all heroes | |
api.get('/', (req, res) => { | |
Hero.find({}, (err, heroes) => { | |
if (err) { | |
return res.send(err); | |
} | |
return res.json(heroes); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment