handlers/v1/cluster.js
function(req, res, next) {
        async.parallel({
            applications: (fn) => {
                const spy = { stash: {} };
                applications.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting applications.'));
                    }

                    return fn(null, spy.stash.body);
                });
            },
            hosts: (fn) => {
                const spy = { stash: {} };
                hosts.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting hosts.'));
                    }

                    return fn(null, spy.stash.body);
                });
            }
        }, (err, results) => {
            if(err) {
                res.stash.code = 500;
                return next();
            }

            res.stash.body = {
                applications: results.applications,
                hosts: results.hosts
            };
            res.stash.code = 200;
            return next();
        });
    }
function(req, res, next) {
        async.parallel({
            applications: (fn) => {
                const spy = { stash: {} };
                applications.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting applications.'));
                    }

                    return fn(null, spy.stash.body);
                });
            },
            hosts: (fn) => {
                const spy = { stash: {} };
                hosts.get(req, spy, () => {
                    if(spy.stash.code !== 200) {
                        return fn(new Error('Error getting hosts.'));
                    }

                    return fn(null, spy.stash.body);
                });
            }
        }, (err, results) => {
            if(err) {
                res.stash.code = 500;
                return next();
            }

            res.stash.body = {
                applications: results.applications,
                hosts: results.hosts
            };
            res.stash.code = 200;
            return next();
        });
    }
function ( req , res , next ) { async . parallel ( { applications : ( fn ) => { const spy = { stash : { } } ; applications . get ( req , spy , ( ) => { if ( spy . stash . code !== 200 ) { return fn ( new Error ( 'Error getting applications.' ) ) ; } return fn ( null , spy . stash . body ) ; } ) ; } , hosts : ( fn ) => { const spy = { stash : { } } ; hosts . get ( req , spy , ( ) => { if ( spy . stash . code !== 200 ) { return fn ( new Error ( 'Error getting hosts.' ) ) ; } return fn ( null , spy . stash . body ) ; } ) ; } } , ( err , results ) => { if ( err ) { res . stash . code = 500 ; return next ( ) ; } res . stash . body = { applications : results . applications , hosts : results . hosts } ; res . stash . code = 200 ; return next ( ) ; } ) ; }
get hosts, applications, and other cluster stuff
get hosts applications and other cluster stuff