首页 > 解决方案 > 将mern堆栈部署到Heroku时如何访问反应页面?

问题描述

我使用 react + node.js(typescript) 成功地将应用程序部署到 Heroku,这是问题,现在我可以在后端访问 api,例如 my-app.com/api/post ,但我不知道如何访问反应页面。以下是我的构建日志

 build
276> tsc && cd client && npm run build
277
278
279> super_sideproject@0.1.0 build
280> react-scripts build
281
282(node:5266) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /home/travis/build/hardco2020/React_Node_Facebook/client/node_modules/postcss-safe-parser/node_modules/postcss/package.json.
283Update this package.json to use a subpath pattern like "./*".
284(Use `node --trace-deprecation ...` to show where the warning was created)
285Creating an optimized production build...
286Compiled with warnings.
287
313
314Search for the keywords to learn more about each warning.
315To ignore, add // eslint-disable-next-line to the line before.
316
317File sizes after gzip:
318
319  78.1 KB  build/static/js/2.4fc22d01.chunk.js
320  5.11 KB  build/static/js/main.ecb6537a.chunk.js
321  1.65 KB  build/static/css/main.d7a5a54e.chunk.css
322  785 B    build/static/js/runtime-main.4f17638d.js
323
324The project was built assuming it is hosted at ./facebook/.
325You can control this with the homepage field in your package.json.
326
327The build folder is ready to be deployed.
328
329Find out more about deployment here:

这是我的文件夹

.
├── .travis.yml
├── client
│   ├── package.json 
│   └── index.js
├── package.json
│   
├── tsconfig.json

所以经过一些研究,我认为关键是管理主页,所以我在客户端的 package.json 中添加了主页 facebook ,我认为它会像 my-app.com/facebook 一样工作,但它不会工作,我是这个部署的新手,所以有人知道如何访问 Heroku 上的前端页面吗?

标签: herokumern

解决方案


推荐阅读