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…
Reference in New Issue