mirror of
https://github.com/originalmk/skrytka-app.git
synced 2024-11-20 10:28:50 +00:00
Removed unecessary code
This commit is contained in:
parent
92abec5fb3
commit
1bde9f1fb0
21
app.js
21
app.js
@ -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.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
|
/* Getting OSP units of provided prefix
|
||||||
* e.g. https://skrytka.app/osp-units?prefix=Gda
|
* e.g. https://skrytka.app/osp-units?prefix=Gda
|
||||||
* Returns 3 matching results sorted by locality, name.*/
|
* Returns 3 matching results sorted by locality, name.*/
|
||||||
|
Loading…
Reference in New Issue
Block a user