RobeeeJay edited this page Aug 23, 2012 · 1 revision

This module loads and then caches in memory a favicon.ico, so it can serve this request quickly.

new fw.FavIcon({ iconPath: "/static/favicon.ico", maxAge: 86400000 });

All arguments are optional, but iconPath should be set to the full path of the icon file to serve. maxAge is the time in milliseconds to be sent as part of the Cache-Control header, and defaults to 86400000.

Note that if you update the favicon.ico file, there is no way for this module to detect it, the application will need to be restarted to notice the change. If this is the sort of thing you may be doing often, then you might prefer to serve this file with the StaticFile module instead.

Simple Example

var stackFull = new fw.Stack();

stackFull.append(new fw.FavIcon({ iconPath: __dirname + "/static/favicon.ico" }));

There we go, a simple example! What more can be said about it?