mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-29 05:00:43 +10:00
Avoid rendering missing static assets through the React app
This commit is contained in:
parent
1bf851ce89
commit
f69570db7d
1 changed files with 8 additions and 0 deletions
|
|
@ -89,6 +89,14 @@ app.use('/static', express.static(path.join(buildPath, 'static')));
|
|||
app.use(cookieParser());
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
if (req.url.startsWith('/static/')) {
|
||||
// The express.static middleware only handles static resources
|
||||
// that it finds, otherwise passes them through. However, we don't
|
||||
// want to render the app for missing static resources and can
|
||||
// just return 404 right away.
|
||||
return res.status(404).send('Static asset not found.');
|
||||
}
|
||||
|
||||
const context = {};
|
||||
|
||||
// Get handle to tokenStore
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue