title: How to add a custom favicon to sails.js application?
body: <p><code>Sails.js</code> app uses a default favicon from express. I want to replace it with my own one but have struggled with it for a couple of hours.</p>
  
  <p>I have tried to add a separate <code>favicon.js</code> with following code under config folder, but without luck.</p>
  
  <pre><code>/**
  * favicon.ico
  */
  var favicon = require('static-favicon');
  var path = require('path');
  
  module.exports = {
    express: {
      customMiddleware: function(app){
        console.log('loading favicon.'); //executed
        app.use(favicon(path.join(__dirname, 'icon_fav.ico')));
        app.use(function (req, res, next) {
          console.log("installed customMiddleware is used");
          next();
        })
      }
    }
  
  };
  </code></pre>
  
  <p>By the way, adding following line in the view template will work in both Chrome and Fire Fox, but not in Safari (OSX), don't know why.</p>
  
  <pre><code>&lt;link rel="icon" href="/img/icon_fav.png" type='image/png'&gt;
  </code></pre>
  
  <p>Also tried to put <code>/favicon.ico</code> under web server root.</p>
  
  <p>Googled for this, and it seems no one asked before.<br>
  Can someone point me to a solution? </p>