重新启动Express.js路由更改,无需重新启动服务器 [英] Reload Express.js routes changes without restarting server

查看:119
本文介绍了重新启动Express.js路由更改,无需重新启动服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过 express-livereload ,但它只是重新加载视图文件。



我应该使用另一个工具,或者这个配置可以用于监视运行服务器的 index.js 文件?



我读到选项与 node-livereload 相同,默认的观看文件包括 .js 文件。



通过简单的配置,您知道的任何URL?



我的主要问题是如何为Express.js设置良好的开发环境,当我提出请求时,我想检查变量,每当我改变一条路线时重新启动,都是痛苦的。



PS尝试 node-inspector 在服务器处理请求时检查变量,但是似乎 node-inspector 不是为了这个,对吗?我想 Nodemon 有你要找的东西。


Nodemon 是一个实用程序,用于监视源中的任何更改并自动重新启动你的服务器适合发展。


示例调用:

  nodemon index.js 


I tried express-livereload, but it just reloaded view files.

Should I use another tool, or this one can be configured to watch for my index.js file which runs the server?

I read that options are the same as node-livereload, and default for watched files include .js files.

Any URL you know with a simple configuration?

My main problem is how to setup good development environment for Express.js, and I would like to inspect the variables when I am making a request, is painful to restart each time I make a change in a route.

PS I tried node-inspector to inspect variables when server handles a request, but it seems node-inspector is not intended for that, right?

解决方案

I think Nodemon has what you're looking for.

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development.

Example invocation:

nodemon index.js

这篇关于重新启动Express.js路由更改,无需重新启动服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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