When this code is run, i
is incremented by two every time and I can't pinpoint in the documentation or otherwise why this would be the case. I'd expect the increment to be by one for each request, but it's not. Why is this behaving the way it is?
var http = require('http');
var i = 0;
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Number: ' + i + '\n');
i++;
}).listen(8000, '127.0.0.1');