Skip to content

Instantly share code, notes, and snippets.

@ctide
Created August 31, 2011 23:37
Show Gist options
  • Save ctide/1185052 to your computer and use it in GitHub Desktop.
Save ctide/1185052 to your computer and use it in GitHub Desktop.
var app = require('express').createServer();
var processInfo;
app.get('/', function(req, res) {
res.writeHead(200, {'content-type':'application/json'});
res.end(JSON.stringify(processInfo));
});
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
processInfo = JSON.parse(chunk);
process.chdir(processInfo.workingDirectory);
app.listen(23456, function() {
process.stdout.write(JSON.stringify({port: 23456}));
});
});
process.stdin.resume();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment