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

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

问题描述

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

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

我是否应该使用其他工具,或者这个可以配置为监视运行服务器的 index.js 文件?

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

我读过那个选项与 node-livereload 相同,监视文件的默认值包括 .js 文件。

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

您使用简单配置知道的任何URL?

Any URL you know with a simple configuration?

我的主要问题是如何为Express.js设置良好的开发环境,以及我想在我提出请求时检查变量,每次在路线上进行更改都会很难重启。

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我试过 node-inspector 在服务器处理请求时检查变量,但似乎 node-inspector 不适用于此,对吧?

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

推荐答案

我认为 Nodemon 有你想要的。


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

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

示例调用:

nodemon index.js

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

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