Typescript migration: Major refactoring.

This commit is contained in:
baldo 2020-04-10 00:43:15 +02:00
parent 31ecc0cf4f
commit 52822207a5
31 changed files with 2068 additions and 2268 deletions
server/resources

View file

@ -0,0 +1,20 @@
import ErrorTypes from "../utils/errorTypes";
import Logger from "../logger";
import {getNodeStatistics} from "../services/nodeService";
import * as Resources from "../utils/resources";
import {Request, Response} from "express";
export function get (req: Request, res: Response): void {
// TODO: Promises and types.
getNodeStatistics()
.then(nodeStatistics => Resources.success(
res,
{
nodes: nodeStatistics
}
))
.catch(err => {
Logger.tag('statistics').error('Error getting statistics:', err);
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
});
}