{"size": 520, "ext": "js", "max_stars_repo_path": "middlewares/getPoiStatus.js", "max_stars_repo_name": "YashdalfTheGray/atlas-network", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "middlewares/getPoiStatus.js", "max_issues_repo_name": "YashdalfTheGray/atlas-network", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "middlewares/getPoiStatus.js", "max_forks_repo_name": "YashdalfTheGray/atlas-network", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.6086956522, "max_line_length": 68, "alphanum_fraction": 0.5846153846}
import request from 'request-promise';

import wrap from '../support/wrapAsync';

const pois = require('../poi');

const getPoiStatus = async (req, res) => {
    const selectedPoi = pois.filter(p => p.id === req.params.id)[0];
    res.send(selectedPoi);

    const responses = selectedPoi.services.map(async (s) => {
        const r = await request({
            url: `http://${s.ip}:${s.port}`
        });

        return { name: s.name, ...r };
    });

    res.send(responses);
};

export default wrap(getPoiStatus);
