微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 mern 堆栈部署到 Heroku 时如何访问 React 页面?

如何解决将 mern 堆栈部署到 Heroku 时如何访问 React 页面?

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

 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

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。