Actually return 404 on stale data

master
Manuel Kasper 2022-04-03 18:17:47 +02:00
rodzic 75bd6507d7
commit ea3e3fc456
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -44,7 +44,7 @@ router.get('/latest', (req, res) => {
// Check that the data is not older than 4 hours
let solardataMoment = moment.utc(solardata.date + "T" + solardata.hour.toString().padStart(2, '0'))
if (moment.utc().diff(solardataMoment, 'hours') > 4) {
console.log('too old')
return res.status(404).end()
}
delete solardata._id