mirror of https://github.com/lukechilds/node.git
1 changed files with 13 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||
|
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-lengt': '2' }); |
||||
|
|
||||
|
var lag = parseInt(req.url.split("/").pop(), 10) || defaultLag; |
||||
|
setTimeout(function() { |
||||
|
res.end('ok'); |
||||
|
}, lag); |
||||
|
}).listen(port, 'localhost'); |
Loading…
Reference in new issue