1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-13 23:05:57 +00:00

So much polish

This commit is contained in:
Scott Tolksdorf
2016-01-04 17:02:55 -05:00
parent b1b69437ea
commit fb8ddfe9fa
16 changed files with 146 additions and 62 deletions

View File

@@ -46,12 +46,12 @@ module.exports = function(app){
//Updating
app.put('/homebrew/update/:id', function(req, res){
HomebrewModel.find({editId : req.params.id}, function(err, objs){
if(!objs.length || err) return res.send(400);
if(!objs.length || err) return res.status(404).send("Can not find homebrew with that id");
var resEntry = objs[0];
resEntry.text = req.body.text;
resEntry.save(function(err, obj){
if(!err) return res.sendStatus(500);
return res.send(200);
if(err) return res.status(500).send("Error while saving");
return res.status(200).send(obj);
})
});
});