Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // контроллер
  2. nodes = ["ddd", "aaa",...];
  3. router.get('/nodes', function(req, res) {
  4. res.json(nodes.map(node =>
  5. manager.getNodeStatus(node, status => { return status; }) // оно не работает :(
  6. ));
  7. });
  8.  
  9. // в менеджере
  10. function getNodeStatus(node, callback) {
  11. new Executor({
  12. args: { path: scriptPath, node: node },
  13. successAction: function(data) {
  14. if(data) {
  15. var result = JSON.parse(data);
  16. callback({
  17. name: node,
  18. status: statusCode[result["Status"]]
  19. });
  20. } else {
  21. console.error(node+"=> Status Checking failed!");
  22. }
  23. }
  24. });
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement