如何将实时重载添加到我的Node.js服务器 [英] How can I add live-reload to my nodejs server

查看:94
本文介绍了如何将实时重载添加到我的Node.js服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我如何运行服务器nodejs.当我对前端开发

This is how can i run my server nodejs. I need to live reload my server when i make changes to the code in the front-end dev

"start": "node server.js"

推荐答案

第一:

npm install -g nodemon

下一步将脚本行添加到package.json

next add a script line to your package.json

"live": "nodemon server.js" 

现在,当您运行npm时,它将实时重新加载

now when you npm live it'll live reload

有关更多详细信息,请参见 https://github.com/remy/nodemon

for more details see https://github.com/remy/nodemon

更新,如果还需要重新加载实时页面

update if live page reload is also needed

npm install -g livereload
livereload . -w 1000 -d

有关更多详细信息,请参见 https://github.com/napcs/node-livereload

for more details see https://github.com/napcs/node-livereload

这篇关于如何将实时重载添加到我的Node.js服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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