{"size": 799, "ext": "js", "max_stars_repo_path": "routes/api.js", "max_stars_repo_name": "tobilg/envoy-mesos-sds", "max_stars_repo_stars_event_min_datetime": "2017-09-01T09:35:37.000Z", "max_stars_repo_stars_event_max_datetime": "2019-05-19T14:45:37.000Z", "max_issues_repo_path": "routes/api.js", "max_issues_repo_name": "tobilg/envoy-mesos-sds", "max_issues_repo_issues_event_min_datetime": "2018-02-09T08:49:15.000Z", "max_issues_repo_issues_event_max_datetime": "2018-02-09T10:39:52.000Z", "max_forks_repo_path": "routes/api.js", "max_forks_repo_name": "tobilg/envoy-mesos-sds", "max_forks_repo_forks_event_min_datetime": "2018-06-19T02:08:55.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-18T09:55:59.000Z"}
{"max_stars_count": 16, "max_issues_count": 2, "max_forks_count": 2, "avg_line_length": 28.5357142857, "max_line_length": 78, "alphanum_fraction": 0.6858573217}
"use strict";

const MesosState = require("../lib/mesos");

let ms = new MesosState({
    masterHost: process.env.MASTER_HOST || "leader.mesos",
    masterPort: process.env.MASTER_PORT || 5050,
    masterProtocol: process.env.MASTER_PROTOCOL || "http",
    masterApiUri: process.env.MASTER_API_URI || "/api/v1",
    masterConnectionTimeout: process.env.MASTER_CONNECTION_TIMEOUT_MS || 5000,
    reconcileIntervalMilliseconds: process.env.RECONCILE_INTERVAL_MS || 60000
});

let router = require("express").Router();

// define the home page route
router.get("/registration/:serviceName", function (req, res) {
    let hosts = [];
    if (req.params.serviceName) {
        hosts = ms.getService(req.params.serviceName);
    }
    res.send({
        hosts: hosts
    });
});

module.exports = router;
