Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .post(function (req, res) {
- var planet = new Planet(req.body);
- Planet.find({name: planet.name}, function (err, planet) {
- if (err) {
- res.status(500).send(err);
- }
- if (planet == '') {
- console.log("action: planet not found");
- //download data from swapi here
- // planet.save();
- } else {
- //send data back
- console.log("action: planet found");
- res.status(201).send(planet);
- }
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement