Christian68
Christian68

Reputation: 987

NodeJS HTTP Server and Console.log

I have a simple HTTP server

require('http').createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World!');

    console.log('Got a request');   
}).listen(4000);

However, when I run it 'Got a request' is written 3 times in the console. Any idea why?

Upvotes: 1

Views: 3446

Answers (1)

Sachacr
Sachacr

Reputation: 732

It's maybe your browser who try to get your favicon

You can confirm this by using : console.log('Got a request : ' + req.url);

Upvotes: 2

Related Questions