Add MCP commands route, fix /robots route
This commit is contained in:
parent
c97514689b
commit
f5734b137e
|
@ -49,8 +49,14 @@ router.get("/commands", function(req, res) {
|
|||
res.json({ commands: Object.keys(Cylon.commands) });
|
||||
});
|
||||
|
||||
router.post("/commands/:command", function(req, res) {
|
||||
var command = req.params.command;
|
||||
var result = Cylon.commands[command].apply(Cylon, req.commandParams);
|
||||
res.json({ result: result });
|
||||
});
|
||||
|
||||
router.get("/robots", function(req, res) {
|
||||
res.json({ robots: Cylon.robots });
|
||||
res.json({ robots: Cylon.toJSON().robots });
|
||||
});
|
||||
|
||||
router.get("/robots/:robot", load, function(req, res) {
|
||||
|
@ -63,7 +69,6 @@ router.get("/robots/:robot/commands", load, function(req, res) {
|
|||
|
||||
router.all("/robots/:robot/commands/:command", load, function(req, res) {
|
||||
var command = req.params.command;
|
||||
|
||||
var result = req.robot[command].apply(req.robot, req.commandParams);
|
||||
res.json({ result: result });
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue