node.js - Why are multiple requests being processed for a single browser request? -


note: new node, , have simple node site running based upon example (http://blog.falafel.com/blogs/basememara/basem-emara/2014/03/18/getting-started-with-node.js-for-windows)

my code is:

var http = require('http'); var reqcount = 0; http.createserver(function (req, res) {     reqcount++;     res.writehead(200, { 'content-type': 'text/plain' });     console.log(reqcount);     res.end('request: ' + reqcount); }).listen(3000); 

in browser 1, hit refresh , 3, 5, 7

and in console getting every int, 2 per request

why executing twice each request?

i know not handling requests directly, wanted start basic , include express.

this may /favicon.ico request done browser.

you can print request url req object see that:

console.log(req.url); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -