migrate to typescript

This commit is contained in:
Dainius Daukševičius
2020-10-17 21:56:54 +03:00
committed by Dainius Dauksevicius
parent c462323dd5
commit 08d27265fc
120 changed files with 5002 additions and 4711 deletions

View File

@@ -0,0 +1,13 @@
import fetch from 'node-fetch';
import {Logger} from '../utils/logger';
import {config} from '../config';
import {getIP} from '../utils/getIP';
import {getHash} from '../utils/getHash';
import {NextFunction, Request, Response} from 'express';
export function userCounter(req: Request, res: Response, next: NextFunction) {
fetch(config.userCounterURL + "/api/v1/addIP?hashedIP=" + getHash(getIP(req), 1), {method: "POST"})
.catch(() => Logger.debug("Failing to connect to user counter at: " + config.userCounterURL));
next();
}