2016-07-19 13:24:43 +02:00
|
|
|
'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});
|
|
|
|
}
|
2016-07-19 13:24:43 +02:00
|
|
|
|
2018-12-17 22:49:54 +01:00
|
|
|
return Resources.success(
|
|
|
|
res,
|
|
|
|
{
|
|
|
|
nodes: nodeStatistics
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|