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.
server
--build
----static
----assets
------favicon.ico
------manifest.json
----index.html
----favicon.ico
----manifest.json
--server.js
localhost => return index.html good
localhost/index.html, favicon.ico, else... => return ERROR
localhost/assets/favicon.ico, manifest.json => 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');