el-borracho-stats
Version:
REST and SSE API and worker producing daily and all-time totals for Bull queues
36 lines (27 loc) • 1.15 kB
JavaScript
// Generated by IcedCoffeeScript 108.0.11
var ElBorrachoStatsRouter, SSEriesOfTubes, Stats;
SSEriesOfTubes = require("sseries-of-tubes");
Stats = require("../el-borracho-stats");
ElBorrachoStatsRouter = (function() {
function ElBorrachoStatsRouter(_arg) {
var namespace, redis, server;
server = _arg.server, redis = _arg.redis, namespace = _arg.namespace, this.router = _arg.router;
this.tubes = new SSEriesOfTubes(server);
this.stats = new Stats({
redis: redis,
namespace: namespace
});
this.router || (this.router = new (require("express")).Router);
this.bindRoutes();
}
ElBorrachoStatsRouter.prototype.bindRoutes = function() {
this.router.get("/sse/all", this.tubes.combine("/sse/history", "/sse"));
this.router.get("/sse/history", this.tubes.plumb(this.stats.history, 30, "history"));
this.router.get("/sse", this.tubes.plumb(this.stats.total, 2, "total"));
this.router.get("/history", this.stats.history);
return this.router.get("/", this.stats.total);
};
return ElBorrachoStatsRouter;
})();
module.exports = ElBorrachoStatsRouter;
//# sourceMappingURL=router.js.map