The spawn
method returns a ChildProcess
object, which gives you access to the stdin and stdout of the process.
It would look something like this:
var child = require('child_process').spawn('python', ['script.py']);
child.stdout.on('data', function(data)
{
response = JSON.parse(data);
console.log(response);
});
child.stdin.write(JSON.stringify(data));