Avoid rendering missing static assets through the React app

This commit is contained in:
Kimmo Puputti 2017-10-05 14:12:50 +03:00
parent 1bf851ce89
commit f69570db7d

View file

@ -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