I'm trying this basic Javascript code in Node.js:
var count=1;
var net = require('http');
net.createServer(function(req,res){
res.writeHead(200,{'Content-Type':'text/plain'});
res.end((count+=1).toString());
}).listen(3000,"127.0.0.1");
Expected result: Each browser hit increments the count output by 1.
Actual result: Firefox increments by 1 (expected)... Safari + Chrome increment by 2
Huh?
Yes, as the comments suggested, it's favicon.ico
.
Next time log req.url
before guessing around :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With