|
|
|
@ -56,14 +56,14 @@ app.get('/status/:gpio', function (req, res) {
|
|
|
|
|
|
|
|
|
|
|
|
child_process.exec(command, function (error, stdout, stderr) {
|
|
|
|
child_process.exec(command, function (error, stdout, stderr) {
|
|
|
|
|
|
|
|
|
|
|
|
return res.status(200).send(stdout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
if (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
return res.status(500).send('Error');
|
|
|
|
return res.status(500).send('Error');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
const status = stdout.match(regex)[1];
|
|
|
|
|
|
|
|
|
|
|
|
console.log('Status', gpio, stdout);
|
|
|
|
console.log('Status', gpio, stdout);
|
|
|
|
return res.status(200).send(stdout);
|
|
|
|
return res.status(200).send(status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|