The favicon for OpenMRS Atlas using express

Hello everyone,

Hope you all are doing well and I’ll explain how I made a favicon show up successfully on my browser after an hour of search.

Currently, I am working on building a node app using express with restful service. So this post will explain how I made a favicon show up in the browser using the features of the express framework.

Initially, I want to brag a bit about the express framework. It is a lightweight node.js web application framework which is currently holding huge recommendation from the node.js community if one wants to build a web app presenting rest services. It has 25750 stars and 4800 forks as I write this.

Some useful resources for express framework

GitHub : Link

How I have done it 

  • Initially, I recommend you to take the code generated by the express generator module (google how u can get the express generator installed locally )
  • If u generate the code using express generator then all u have to do is jus uncomment the following code which u get by default.

app.use(favicon(path.join(‘public’, ‘images’,’favicon.ico’)));

in the above line we use path and favicon dependencies which come by default if u have used the express generator.

if not you have to do the following

var path = require(path);

var favicon = require(serve-favicon);


app.use(favicon(path.join(public, images,favicon.ico)));


you’ll have to place the favicon.ico file in the public/images directory 🙂

For any queries ask in #express , #nodejs channel via IRC. I am sure they’ll help you.


Thank you





Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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