How can I replace the default favicon icon in the created loopc loopback web package?

I created the application using the loop loopback command. Thus, the generated express webapp has its own symbolic symbol. How to change the icon?

I use this in server.js

app.use(loopback.favicon(path.resolve(__dirname, '../client/favicon.ico'))); 

I also tried with the html link tag, but loading is loaded by default.

What am I doing wrong?

+5
source share
3 answers

Set the path to your custom character in server/middleware.json :

 { "initial:before": { "loopback#favicon": { "params": "path/to/your/favicon.ico" } }, … 

We had problems setting paths only in HTML, with some reboots the StrongLoop sign icon still appeared by default. This configuration helped.

PS: If your favicon.ico is in the root directory of the client, use this path: "$!../client/favicon.ico"

+12
source

Some browsers aggressively cache badges. Try <yourhost>/favicon.ico to <yourhost>/favicon.ico and see if it shows the correct file to make sure that this is not a client-side problem.

+2
source

The default icon is configured on the /middleware.json server:

 { "initial:before": { "loopback#favicon": {} }, 

Pay attention to the initial one: before the phase that precedes the routes phase (app.use). You must change the /middleware.json server for your purpose.

+2
source

All Articles