Added check for unreachable coords

This commit is contained in:
Alexis
2023-04-27 11:34:55 +02:00
parent b6f90c95e5
commit 6f427829bc

View File

@@ -28,6 +28,13 @@ app.use('/rep', async (req, res) => {
const code = gl.getContainers(pos).features[0]?.properties["REF"]
if (!code) {
res.json({
"message": "The requested data couldn't be found. Maybe it was moved or the data isn't generated properly."
}).status(404).end();
return
}
const repFile = fs.readFileSync(path.join(__dirname, `public/reps/${lookupTable[code]}.json`), 'utf-8');
res.end(repFile);