Skip to content

Instantly share code, notes, and snippets.

@outbounder
Created September 10, 2010 08:33
Show Gist options
  • Save outbounder/573316 to your computer and use it in GitHub Desktop.
Save outbounder/573316 to your computer and use it in GitHub Desktop.
var http = require('http');
var finishedJobs = [];
http.createServer(function (request, response) {
if(finishedJobs[request.pathname]) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end(finishedJobs[request.pathname].toString());
} else {
response.writeHead(404, {'Content-Type': 'text/plain'});
response.end("Result not found");
}
}).listen(80);
console.log('Server running at http://127.0.0.1:80/');
var intervalID = setInterval(function() {
// select pending jobs
// process jobs
finishedJobs[job.id] = job;
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment