DEV Community

Discussion on: Deploy a fullstack NX workspace on Heroku

Collapse
codsworth profile image
codsworth Author

Here you need to update the express to serve the static build of the frontend app. It is these lines that you need to add

const CLIENT_BUILD_PATH = path.join(__dirname, '../nx-fullstack');

const app = express();
app.use(express.static(CLIENT_BUILD_PATH));
Enter fullscreen mode Exit fullscreen mode

and

// This route needs to come last after all your other api routes
app.get('*', (request, response) => {
  response.sendFile(path.join(CLIENT_BUILD_PATH, 'index.html'));
});
Enter fullscreen mode Exit fullscreen mode