Skip to content

Commit

Permalink
fix(fsweb): deliver react bundle on all fall-through requests
Browse files Browse the repository at this point in the history
if a route isn't handled by one of the middlewares (eg. static files, proxy), deliver the react
bundle. the application router will handle rendering the proper content.
  • Loading branch information
nathan-sankbeil committed Apr 29, 2021
1 parent 7778150 commit 126d012
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/fsweb/src/server.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ healthCheck(app, env);

addProxy(app, env);

app.all('*', (req, res) => {
// Send the react bundle to all requests that haven't been handled by the above middleware.
res.sendFile(path.resolve(__dirname, rootDir, buildPath, 'index.html'));
});

app.listen(port, () => {
console.info(`Proxy listening on port ${port}`);
}).on('error', err => {
Expand Down

0 comments on commit 126d012

Please sign in to comment.