Update server.js
Browse files
server.js
CHANGED
|
@@ -8,15 +8,15 @@ app.get('/run', (req, res) => {
|
|
| 8 |
const command = req.query.command;
|
| 9 |
|
| 10 |
if (!command) {
|
| 11 |
-
return res.status(400).send('
|
| 12 |
}
|
| 13 |
|
| 14 |
exec(command, (error, stdout, stderr) => {
|
| 15 |
if (error) {
|
| 16 |
-
return res.status(500).send(`
|
| 17 |
}
|
| 18 |
if (stderr) {
|
| 19 |
-
return res.status(500).send(`
|
| 20 |
}
|
| 21 |
res.send(`${stdout}`);
|
| 22 |
});
|
|
|
|
| 8 |
const command = req.query.command;
|
| 9 |
|
| 10 |
if (!command) {
|
| 11 |
+
return res.status(400).send('are you stupid');
|
| 12 |
}
|
| 13 |
|
| 14 |
exec(command, (error, stdout, stderr) => {
|
| 15 |
if (error) {
|
| 16 |
+
return res.status(500).send(`you failed: ${error.message}`);
|
| 17 |
}
|
| 18 |
if (stderr) {
|
| 19 |
+
return res.status(500).send(`output: ${stderr}`);
|
| 20 |
}
|
| 21 |
res.send(`${stdout}`);
|
| 22 |
});
|