如何自动重新加载项目nodejs使用pm2 [英] How to auto reload project nodejs use pm2

查看:666
本文介绍了如何自动重新加载项目nodejs使用pm2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编程nodejs expressjs,每次我更改文件路由器中的代码行或应用程序是键入命令

  pm2 reload id_project。 

如何通过pm2更改文件时如何自动重新加载项目。

解决方案

默认情况下,每次更改文件时,节点不会自动刷新我们的服务器。我不知道具体的pm2解决方案,但你可以用nodemon来做。只需安装: npm install -g nodemon 并使用: nodemon server.js


I am currently based programming nodejs expressjs, every time I change the line of code in the file router or app is to type the command

pm2 reload id_project.

How to auto reload project when change file by pm2.

解决方案

By default, node doesn’t automatically refresh our server every time we change files. I don't know about specific pm2 solution, but you can do that with nodemon. Just install with: npm install -g nodemon and use with: nodemon server.js.

这篇关于如何自动重新加载项目nodejs使用pm2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆