使用 Heroku 部署全栈应用程序 - Express 后端,React 前端?

Deploy full-stack app with Heroku - Express back end, React front end?

我构建了我的第一个全栈应用程序,具有 Express 后端和 React 前端,包含在同一个项目文件夹中 (see GitHub repo)。前端包含在名为 client 的文件夹中。 我从根目录部署了应用程序——在部署的站点上,它只是说 "Cannot GET /." 前端部分的 package.json 有一个代理字段,将请求代理到后端。当我在本地主机上打开项目时,一切正常。 任何指针将不胜感激。

 "scripts": {
    "start": "node server",
    "heroku-postbuild": "cd client && npm install && npm run build"
  },

尝试在后端 package.json 部分进行修复。首先,您想要设置后端,然后 Heroku 需要 React 到 运行。 Heroku 有一些怪癖。