mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
150053b3fa
Thanks, @mscdex
14 lines
429 B
JavaScript
14 lines
429 B
JavaScript
var http = require('http');
|
|
var port = parseInt(process.env.PORT, 10) || 8000;
|
|
var defaultLag = parseInt(process.argv[2], 10) || 100;
|
|
|
|
http.createServer(function(req, res) {
|
|
res.writeHead(200, { 'content-type': 'text/plain',
|
|
'content-length': '2' });
|
|
|
|
var lag = parseInt(req.url.split("/").pop(), 10) || defaultLag;
|
|
setTimeout(function() {
|
|
res.end('ok');
|
|
}, lag);
|
|
}).listen(port, 'localhost');
|