arma-server-web-admin/routes/mods.js

44 lines
916 B
JavaScript
Raw Normal View History

module.exports = function (modsManager) {
return {
index: function(req, res){
res.send(modsManager.mods);
},
create: function(req, res){
modsManager.download(req.body.name);
res.send(204, {});
},
update: function(req, res){
modsManager.download(req.params.mod);
res.send(204, {});
},
2014-04-04 08:37:43 +00:00
destroy: function(req, res){
2015-07-22 18:16:30 +00:00
modsManager.delete(req.params.mod, function (err) {
if (err) {
res.send(500, err);
} else {
res.send(204, {});
}
});
},
2015-02-01 04:01:50 +00:00
2015-05-29 23:30:53 +00:00
refresh: function(req, res){
modsManager.updateMods();
res.send(200, {});
},
2015-02-01 04:01:50 +00:00
search: function(req, res){
var query = req.body.query || "";
modsManager.search(query, function (err, mods) {
if (err || !mods) {
res.send(500, err);
} else {
res.send(mods);
}
});
}
};
};