[英]How to upload nodejs project or install nodejs and npm modules on live server
I've made a real time chat application with node and socket io and it is running well in my local machine. 我已经用node和socket io制作了一个实时聊天应用程序,它在我的本地计算机上运行良好。 But its time to run it on my live windows server.
但是是时候在我的实时Windows服务器上运行它了。 I can't understand to how set it up there.
我不明白该如何设置。 Do I need to upload the files to the server or I've to install node js and npm modules in the server and then upload the files.
我是否需要将文件上传到服务器,还是必须在服务器中安装node js和npm模块,然后上传文件。 And how I can do these?
我该怎么做? How I'll run the command prompt as we do in local machine like node chat.js ?
我将如何像在节点chat.js这样的本地计算机中那样运行命令提示符? Any help is appreciated.
任何帮助表示赞赏。 Thanks in advance.
提前致谢。
You can use a deployment client like Capistrano or you can just upload your source files then run npm install (assuming your have node installed) followed by your commands to bring up the server. 您可以使用Capistrano之类的部署客户端,也可以仅上传源文件,然后运行npm install(假设已安装节点),然后运行命令来启动服务器。 I'd suggest using a framework like meteor or sails to make deployment easier.
我建议使用流星或帆这样的框架来简化部署。 Or using a cloud solution like heroku .
或者使用诸如heroku之类的云解决方案。
Keep it simple: 把事情简单化:
.bat
file that does all the preparations and runs your code. .bat
文件,该文件将进行所有准备工作并运行您的代码。 In the simplest case, it would contain node path\\to\\project\\chat.js
. node path\\to\\project\\chat.js
Then, run this file using a console. .bat
file to your repository. .bat
文件包括在存储库中。 Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.