Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.get('/discover', function(req, res){
let discovery = new DeviceDiscovery()
discovery.discoverMultiple({ timeout: 5000 })
.then((devices) => {
let sonosDev = [];
devices.forEach(device => {
sonosDev.push(`${device.host}`);
});
res.json(sonosDev);
})
.catch((error) => {
if(error){
res.sendStatus(404);
}
});
});