dvdzkwsk / react-redux-starter-kit

Get started with React, Redux, and React-Router.
MIT License
10.28k stars 2.2k forks source link

how browser get favicon? #1318

Closed YutHelloWorld closed 7 years ago

YutHelloWorld commented 7 years ago

Hi,thx very much for this project. I have a question about how browser gets favicon.ico? I did not see server-favicon or app.use(favicon(...)) anywhere. In server/main.js, i find these code works for favicon.

app.use(express.static(path.resolve(project.basePath, 'public')))
app.use('*', function (req, res, next) {
    const filename = path.join(compiler.outputPath, 'index.html')
    compiler.outputFileSystem.readFile(filename, (err, result) => {
      if (err) {
        return next(err)
      }
      res.set('content-type', 'text/html')
      res.send(result)
      res.end()
    })
  }) 

but i don't konw how it works .Could u get a explanation? thx very much!

YutHelloWorld commented 7 years ago

I find this FQA at https://stackoverflow.com/questions/35408729/express-js-prevent-get-favicon-ico . maybe is the answer!