1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-16 17:21:29 +00:00

Added in new page, however edit page is still broken

This commit is contained in:
Scott Tolksdorf
2016-05-09 13:17:17 -04:00
parent eca3ada8eb
commit 15ad171c2d
6 changed files with 182 additions and 46 deletions

View File

@@ -34,9 +34,17 @@ module.exports = function(app){
getTopBrews(function(topBrews){
return res.json(topBrews);
});
})
});
app.put('/homebrew/update/:id', function(req, res){
app.post('/homebrew/api', function(req, res){
var newHomebrew = new HomebrewModel(req.body);
newHomebrew.save(function(err, obj){
if(err) return;
return res.json(obj);
})
});
app.put('/homebrew/api/update/:id', function(req, res){
HomebrewModel.find({editId : req.params.id}, function(err, objs){
if(!objs.length || err) return res.status(404).send("Can not find homebrew with that id");
var resEntry = objs[0];