Static content not served when deploying full stack PERN app on Heroku

I made a simple financial app consisting of a React frontend and Node/express backend that I want to deploy to Heroku. Since it’s a small app I put everything (server as well as client files) in the root directory of my git repository. Thus the entry files for frontend (index.html), backend (index.js) and the Procfile required by Heroku are all in the root directory.

The server seems to be working fine, since I can successfully make requests from the locally installed frontend. However it appears that the server doesn’t serve the static files.

This is the log message from heroku:

2021-07-29T15:21:00.260957+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/" request_id=2a484f4d-30cf-49b9-920d-14b9e9be28fb fwd="" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https

I am serving the static files using this server code:

if (process.env.NODE_ENV === 'production') {

Anyone has any idea why my files aren’t served?