Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does express.favicon() do

I would like to know what express.favicon() does. I seared and could not get the reasoning.

can any one explain me on this.

app.use(express.favicon());

I read some link that this command will do a ignore of GET/favicon.ico. I am looking for understanding more about this like?where is the function: express.favicon() defined and all those information, I did checked in the expresss website could not find the declaration/definition of this function

like image 817
The Learner Avatar asked Dec 23 '12 01:12

The Learner


People also ask

Where do I put favicon Express?

If you are using Express. static to serve a folder, just put the favicon. ico file in the root of that folder and it will be served when the browser requests it. There's no need to add a link tag to your html or a special middleware route in the application code.

What is favicon in NodeJS?

A favicon is a small size file as known as website icon, tab icon, URL icon or bookmark icon. The serve-favicon module is used to serve favicon from the NodeJS server.

What is favicon ICO used for?

Originally, the favicon was a file called favicon. ico placed in the root directory of a website. It was used in Internet Explorer's favorites (bookmarks) and next to the URL in the address bar if the page was bookmarked.


2 Answers

It defines a favicon for your application. Passing no path to a favicon will serve up the express favicon by default.

like image 164
Ry- Avatar answered Sep 28 '22 01:09

Ry-


As far as I can tell, it loads the /favicon.ico file from your site (like it would if you have the static handler loaded) but then caches it.

So, the advantage of using this over just the static handler is that it caches it more.

http://www.senchalabs.org/connect/favicon.html

like image 42
Chris Kimpton Avatar answered Sep 27 '22 23:09

Chris Kimpton