I have a very basic Express web server:
var app = module.exports = express.createServer();
app.get('/:user', function(req, res) {
console.log('GET');
});
app.param('user', function(req, res, next, id) {
console.log('PARAM');
next();
});
app.listen(3000);
When I run http://localhost:3000/MyName, I have the following output in my console:
PARAM
GET
PARAM
GET
Why do I get every output twice?
The browser most likely sent a second request on its own in order to get the favicon (
http://localhost:3000/favicon.ico).