Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
express.static() cannot get favicon and files without index.html in build folder

express can't find static files in build folder. express can serve files in static folder now. but only problem that file path likes <link rel="icon" href="/favicon.ico"/> in index.html it reach res.send('ERROR')

however, when I change favicon and manifest path like <link rel="icon" href="/assets/favicon.ico"/>. it serve file I expected.

  • add : I found that if url is localhost//favicon.ico, can access favicon.ico in build folder. (not in assets). only double slash can access build folder, single slash cannot access that. Is my express startpoint localhost/ not localhost?
    server  
    |-server.js
    |-build  
      |-static  
        |-assets  
          |-favicon.ico
          |-manifest.json
        |-index.html  
        |-favicon.ico  
        |-manifest.json  
   
    localhost => return index.html good  
    localhost/index.html, favicon.ico, else... => return ERROR  
    localhost/assets/favicon.ico, manifest.json => return files good
    localhost//index.html, favicon.ico. else... => return files good  
    app.use('/static', express.static(path.join(__dirname, 'build/static')));
    app.use(express.static(path.join(__dirname, 'build')));
    app.use('/*', (req, res) => res.send('ERROR');
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!