mirror of
https://github.com/franjsco/trackmyd-api
synced 2025-02-19 12:50:38 +01:00
implements status code 404 in index
This commit is contained in:
parent
31c147392b
commit
008b8f2360
@ -11,11 +11,15 @@ function index(req, res) {
|
||||
return res.json(device);
|
||||
});
|
||||
} else {
|
||||
Device.get((err, devices) => {
|
||||
Device.find({}, (err, devices) => {
|
||||
if (err) {
|
||||
logger.logError(`index: ${err}`);
|
||||
return res.status(500).send();
|
||||
}
|
||||
|
||||
if (devices.length === 0) {
|
||||
return res.status(404).send();
|
||||
}
|
||||
return res.json(devices);
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user