host detail fixes

This commit is contained in:
2019-12-20 13:46:05 -05:00
parent a9026f037e
commit 408c86f86a
2 changed files with 21 additions and 28 deletions

View File

@ -15,13 +15,14 @@ router.get('/:host', async function(req, res){
});
});
router.get('/', async function(req, res){
router.get('/', async function(req, res, next){
try{
return res.json({
hosts: req.query.detail ? await host.listAllDetail() : await Host.listAll()
hosts: req.query.detail ? await Host.listAllDetail() : await Host.listAll()
});
}catch(error){
return res.status(500).json({message: `ERROR ${error}`});
res.status(500)
next(error)
}
});