M41 Highway

Data science and software engineering blog


Leave a comment

Customize your own favicon in Kraken JS

Kraken JS is built on top of Express JS and Connect JS. It inherits the favicon of Connect JS by default and you may spend some time to get rid of it, just like me. Here is the workaround, and it is expected to have this feature in later release. The author suggested the solution in https://github.com/paypal/kraken-js/pull/106, but I would put it in app.requestStart instead.

In the index.js, remove the favicon middleware, and add your own favicon.

app.requestStart = function requestStart(server) {
   server.stack.some(function (middleware, idx, stack) {
   if (middleware.handle.name === 'favicon') {
      stack.splice(idx, 1);
      server.use(express.favicon(__dirname + '/public/favicon.ico'));
      return true;
   }
});