UNPKG

pandora-metrics

Version:
32 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const debug = require('debug')('pandora:metrics:resource:process'); class ProcessResource { constructor(endPointService) { this.prefix = '/process'; this.endPointService = endPointService; } route(router) { const processEndPoint = this.endPointService.getEndPoint('process'); router.get('/', async (ctx, next) => { if (!ctx.query['appName']) { ctx.fail('please query data by appName'); } else { try { const processInfos = await processEndPoint.invoke(ctx.query); ctx.ok((processInfos || []).map(info => { return info.data; })); } catch (err) { debug(err); ctx.fail(err.message); } } await next(); }); } } exports.ProcessResource = ProcessResource; //# sourceMappingURL=ProcessResource.js.map