const http = require('http'); const child = require("child_process"); let qemucmd = "qemu-system-x86_64 -vnc :1 -m 1G" child.execSync(qemucmd) http.createServer(function (req, res) { res.write('Server running at IP 127.0.0.1:5901 (VNC)'); //write a response to the client res.end(); //end the response }).listen(8080); //the server object listens on port 8080