Simple http server

Well, that might be a dumb question, but I'm as n00b as I can be, regarding node.

I set up a server, with code that we can find in any node view or tutorial ...

var http = require('http');

var server = http.createServer(function(req, res){
    console.log('connection from: ' res.socket.remoteAddress);

    res.writeHead(200, ['Content-Type', 'text/plain']);
    res.write('Hello ');
    res.end('World');
});

server.listen('8080');

My question is: why does my server log my message twice for every request I make from the browser?

+5
source share
3 answers

Your browser requests img for use in the upper corner of favicon.

+16
source

As @megakorre reports, this is the default browser behavior regarding favicons. He mentioned in the Node Beginner Book , which is worth checking out. I'm also at the Node 'n00b' stage, and that helped me a lot.

+6
source

Express (http://expressjs.com/). , ( , "/users" "/users/: id" ), , favicon.ico.

+2
source

All Articles