Added a security message to the /speedtests/latest route

This commit is contained in:
Mathias Wagner
2022-04-06 21:14:09 +02:00
parent 604f0dcd49
commit 0b003cee2e
+3 -1
View File
@@ -8,7 +8,9 @@ app.get("/", (req, res) => {
// List only the latest speedtest
app.get("/latest", (req, res) => {
res.json(tests.latest());
let latest = tests.latest();
if (latest === undefined) return res.status(404).json({message: "No speedtest has been made yet"});
res.json(latest);
});
// Get a specific speedtest