ffffng/server/resources/statisticsResource.js

25 lines
706 B
JavaScript
Raw Permalink Normal View History

'use strict';
2018-12-17 22:49:54 +01:00
const ErrorTypes = require('../utils/errorTypes')
const Logger = require('../logger')
const NodeService = require('../services/nodeService')
const Resources = require('../utils/resources')
module.exports = {
get (req, res) {
NodeService.getNodeStatistics((err, nodeStatistics) => {
if (err) {
Logger.tag('statistics').error('Error getting statistics:', err);
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
}
2018-12-17 22:49:54 +01:00
return Resources.success(
res,
{
nodes: nodeStatistics
}
);
});
}
}