简体   繁体   English

将Nodejs + ReactJs部署到Heroku

[英]Deploy Nodejs + ReactJs to Heroku

I'm learning how to deploy a web site to heroku. 我正在学习如何将网站部署到heroku。 My web app has a nodejs project and one mysql in the server side, a reactjs in the client side. 我的web应用程序在服务器端有一个nodejs项目和一个mysql,在客户端有一个reactjs。 Can you show me the steps that I need to do? 你能告诉我我需要做的步骤吗? Because I'm new to this. 因为我是新手。 Thank you very much 非常感谢你

Here is a step by step guide. 这是一步一步的指南。

Put your app aside for a few moments and follow these: 暂停你的应用程序一会儿,然后按照以下步骤操作:

  • To learn how to deploy a nodejs 要了解如何部署nodejs

https://devcenter.heroku.com/articles/deploying-nodejs https://devcenter.heroku.com/articles/deploying-nodejs

  • Now learning how to add a mysql database 现在学习如何添加一个mysql数据库

https://devcenter.heroku.com/articles/cleardb#provisioning-the-shared-mysql-add-on https://devcenter.heroku.com/articles/cleardb#provisioning-the-shared-mysql-add-on

  • This will teach you how to deploy a 'raw' react app 这将教你如何部署'原始'反应应用程序

https://blog.heroku.com/deploying-react-with-zero-configuration https://blog.heroku.com/deploying-react-with-zero-configuration

Now, it's all about how you want things to be. 现在,这都是关于你想要的事情。 You can have a route on your nodejs app that serves the index.html with the react app or a separate app for nodejs and for react. 您可以在nodejs应用程序上使用react应用程序或者为nodejs提供单独的应用程序并进行响应,从而为index.html提供路由。 You should probably make them separated, just to keep things organized, but since it's your first deploy and you're probably using it as a hobby or to learn, any way is correct as long as you get it to work. 你可能应该将它们分开,只是为了保持组织有序,但是因为它是你的第一次部署而你可能将它用作业余爱好或学习,只要你让它工作,任何方式都是正确的。 Then you can build on top of that, split the apps into two, or maybe host the react app on aws s3. 然后你可以在此基础上构建,将应用程序拆分为两个,或者在aws s3上托管react应用程序。 Who knows? 谁知道?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM