kopia lustrzana https://github.com/manuelkasper/sotlas-api
Actually return 404 on stale data
rodzic
75bd6507d7
commit
ea3e3fc456
|
@ -44,7 +44,7 @@ router.get('/latest', (req, res) => {
|
||||||
// Check that the data is not older than 4 hours
|
// Check that the data is not older than 4 hours
|
||||||
let solardataMoment = moment.utc(solardata.date + "T" + solardata.hour.toString().padStart(2, '0'))
|
let solardataMoment = moment.utc(solardata.date + "T" + solardata.hour.toString().padStart(2, '0'))
|
||||||
if (moment.utc().diff(solardataMoment, 'hours') > 4) {
|
if (moment.utc().diff(solardataMoment, 'hours') > 4) {
|
||||||
console.log('too old')
|
return res.status(404).end()
|
||||||
}
|
}
|
||||||
|
|
||||||
delete solardata._id
|
delete solardata._id
|
||||||
|
|
Ładowanie…
Reference in New Issue