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

47 lines
1.1 KiB
JavaScript
Raw Normal View History

module.exports = function (manager, mods) {
return {
index: function (req, res){
res.send(manager.getServers());
},
2014-04-06 22:58:17 +00:00
create: function (req, res) {
var server = manager.addServer(req.body);
res.send(server);
},
2014-04-04 08:37:43 +00:00
show: function (req, res){
var server = manager.getServer(req.params.server);
res.send(server);
},
2014-04-04 08:37:43 +00:00
update: function(req, res){
var server = manager.getServer(req.params.server);
server.update(req.body);
manager.save();
res.send(server);
},
2014-04-08 20:59:59 +00:00
destroy: function(req, res){
var server = manager.removeServer(req.params.server);
2014-06-04 22:17:18 +00:00
res.send(server);
},
2014-04-06 21:09:52 +00:00
start: function (req, res){
var server = manager.getServer(req.params.server);
server.start();
res.send({status:"ok", pid: server.pid});
},
2014-04-06 22:58:17 +00:00
stop: function (req, res){
var server = manager.getServer(req.params.server);
server.stop(function () {
if (!server.pid) {
res.send({status: true, pid: server.pid});
} else {
res.send({status: false, pid: server.pid});
}
});
},
};
2014-04-06 21:09:52 +00:00
};