Implemented toJSON on server object

This commit is contained in:
Björn Dahlgren 2014-06-05 00:17:18 +02:00
parent 1cfaab7992
commit 588c01522b
2 changed files with 14 additions and 20 deletions

View File

@ -91,7 +91,17 @@ Server.prototype.stop = function(cb) {
}, 5000);
return this;
}
};
Server.prototype.toJSON = function () {
return {
id: this.id,
title: this.title,
port: this.port,
mods: this.mods,
pid: this.pid,
};
};
function Manager() {
this.serversArr = [];

View File

@ -41,13 +41,7 @@ exports.create = function (req, res){
exports.show = function (req, res){
var server = manager.getServer(req.params.server);
res.send({
id: server.id,
title: server.title,
port: server.port,
mods: server.mods,
pid: server.pid,
});
res.send(server);
};
exports.update = function(req, res){
@ -67,20 +61,10 @@ exports.update = function(req, res){
manager.save();
}
res.send({
id: server.id,
title: server.title,
port: server.port,
mods: server.mods,
});
res.send(server);
});
} else {
res.send({
id: server.id,
title: server.title,
port: server.port,
mods: server.mods,
});
res.send(server);
}
};