I'm currently running a simple express.js example just trying to get favicons working. Everything works fine locally but when I upload it to my production server it just shows the default favicon. I've tried clearing the cache but the production server favicon seems to not want to show up. I'm running everything on iisnode on a windows 2008 aws server.
Anyone know what the problem might be?
var express = require('express');
var app = express();
var port = process.env.PORT || 3000;
var bodyParser = require('body-parser');
var favicon = require('serve-favicon');
app.use(express.favicon(__dirname + '/views/icons/favicon.ico'));
console.log("full path is: " + (__dirname + '/views/icons/favicon.ico'));
console.log('The magic happens on port ' + port);
Install the favicon middleware and then do:
var favicon = require('serve-favicon'); app.use(favicon(__dirname + '/public/images/favicon.ico'));
Or better, using the path module:
(note that this solution will work in express 3 apps as well)
Removed in Express 4 : app.configure()
app.configure() is no longer available. Refer to this for more info.