var http = require("http"); function onRequest(request, response) { exec("sh myscript.sh", function(err, stdout, stderr){util.puts(stdout)}); response.end(); } http.createServer(onRequest).listen(8888);