mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
4bb529d972
Apply strict mode to benchmark code. PR-URL: https://github.com/nodejs/node/pull/5336 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
16 lines
444 B
JavaScript
16 lines
444 B
JavaScript
'use strict';
|
|
|
|
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');
|