I created as simple example using child_process to do heavy calculating if you would like to use it.
You can do it like this:
var http = require("http"),
exec = require("child_process").exec;
http.createServer(function(request, response) {
var endvalue;
request.on('data',
function(data) {
endvalue = data;
});
request.on('end',
function() {
exec("node calculate.js "+endvalue,
function (error, stdout, stderr) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write(stdout);
response.end();
});
});
}).listen(8080);
Calculate.js:
var endvalue = process.argv[2];
for (i=0;i<=endvalue;i=i+1)
{
//just keeping it busy
}
console.log("FINISHED USING ENDVALUE: "+endvalue);