Added test cli functionality
This commit is contained in:
parent
ad6ab2ecab
commit
1d632252bf
2 changed files with 19 additions and 0 deletions
13
scoreboard/controllers/cli.js
Normal file
13
scoreboard/controllers/cli.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const exec = require('node:child_process');
|
||||
|
||||
// run the `ls` command using exec
|
||||
exec('ls ./', (err, output) => {
|
||||
// once the command has completed, the callback function is called
|
||||
if (err) {
|
||||
// log and return if we encounter an error
|
||||
console.error("could not execute command: ", err)
|
||||
return
|
||||
}
|
||||
// log the output received from the command
|
||||
console.log("Output: \n", output)
|
||||
})
|
||||
|
|
@ -17,6 +17,12 @@ router.get('/refreshMonitor', function(req, res, next) {
|
|||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// Express router endpoint to do cli stuff
|
||||
router.get('/cli', function(req, res, next) {
|
||||
res.status(200); // Set http status code to 200 (success)
|
||||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// Timerendpoints
|
||||
// ######################################################################################################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue