M41 Highway

Data science and software engineering blog

Customize your own favicon in Kraken JS

Leave a comment

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;
   }
});

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s