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

trying to improve the admin view

This commit is contained in:
Scott
2016-02-19 15:37:58 -05:00
parent 2231dc3684
commit a1b8d4e8ce
6 changed files with 126 additions and 92 deletions

View File

@@ -57,6 +57,28 @@ module.exports = function(app){
}
});
app.get('/homebrew/clear', function(req, res){
//if(req.query && req.query.admin_key == process.env.ADMIN_KEY){
HomebrewModel.find({text : ''}, function(err, objs){
return res.json(objs);
if(!objs.length || err) return res.status(404).send("Can not find homebrew with that id");
var resEntry = objs[0];
resEntry.remove(function(err){
if(err) return res.status(500).send("Error while removing");
return res.status(200).send();
})
});
//}else{
// return res.status(401).send('Access denied');
//}
});
//Edit Page
app.get('/homebrew/edit/:id', function(req, res){