Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // контроллер
- nodes = ["ddd", "aaa",...];
- router.get('/nodes', function(req, res) {
- res.json(nodes.map(node =>
- manager.getNodeStatus(node, status => { return status; }) // оно не работает :(
- ));
- });
- // в менеджере
- function getNodeStatus(node, callback) {
- new Executor({
- args: { path: scriptPath, node: node },
- successAction: function(data) {
- if(data) {
- var result = JSON.parse(data);
- callback({
- name: node,
- status: statusCode[result["Status"]]
- });
- } else {
- console.error(node+"=> Status Checking failed!");
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement