简体   繁体   English

使用node.js后端部署React网站

[英]Deploy React website with node.js backend

I have developed website in react and node.js as intermediary to send and receive response. 我在react和node.js中开发了网站作为发送和接收响应的中介。 Now i want to put this on a machine in lab , so everyone can access it. 现在我想将它放在实验室的机器上,这样每个人都可以访问它。 Can i Install node on machine in lab and run same setup as on my dev machine and give ip of that server? 我可以在实验室的机器上安装节点并运行与我的开发机器相同的设置并给出该服务器的IP吗?

I tried searching deployment with node js an react, but everyone using AWS, or some external server after npm build. 我尝试使用节点js进行部署搜索,但是在npm构建之后,每个人都使用AWS或一些外部服务器。 How do I deploy my react app on lab machine with out actually copying code? 如何在实验室机器上部署我的反应应用程序而不实际复制代码?

如果您希望每个人都访问您的服务器,您可以与他们共享您的私人IP,以便其他人可以使用它来访问它

yourip:port

Two Things before you share your IP and PORT: 分享IP和PORT之前的两件事:

  1. Have a process monitor setup in your lab machine, Check out pm2 . 在实验室机器中设置过程监视器,请查看pm2 This will help you run your application in the background, monitor your application and start your application after restart. 这将帮助您在后台运行应用程序,监视应用程序并在重新启动后启动应用程序。

  2. Enable port in your firewall for everyone to use. 在防火墙中启用端口供所有人使用。 if your lab system is Ubuntu then allow ufw for the port. 如果您的实验室系统是Ubuntu,那么允许ufw用于端口。

Now you can share your IP:PORT and everyone would be able to access it, provided they all are connected to the same network. 现在您可以共享您的IP:PORT,只要它们都连接到同一网络,每个人都可以访问它。

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

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