Removed unecessary code

This commit is contained in:
Maciej Krzyżanowski 2023-03-13 20:21:39 +01:00
parent 92abec5fb3
commit 1bde9f1fb0

21
app.js
View File

@ -66,29 +66,8 @@ app.use(session({
}
}));
console.log(process.env.DB_NAME);
let latencies = [0];
const MAX_LATENCIES = 25;
app.use(responseTime(function(req, res, time) {
if(latencies.length > MAX_LATENCIES) {
latencies.shift();
}
latencies.push(time);
}));
app.use(express.json());
app.get('/ping', (req, res) => {
let latenciesSum = 0;
latencies.forEach(l => latenciesSum += l);
const avgLatency = latenciesSum / latencies.length;
res.status(200);
res.send(`Pong! (average latency: ${avgLatency}ms)`);
});
/* Getting OSP units of provided prefix
* e.g. https://skrytka.app/osp-units?prefix=Gda
* Returns 3 matching results sorted by locality, name.*/