Aug 31, 2018 · 1 min read
You basically have to add both:
// root (/) should always serve our server rendered page
router.use('^/$', actionIndex);// other static resources should just be served as they are
router.use(express.static(
path.resolve(__dirname, '..', '..', 'build'),
{ maxAge: '30d' },
));// any other route should be handled by react-router
router.use('*', actionIndex);
Order is important as the router will stop at first match.
