重新加载Express.js路由更改,而无需手动重新启动服务器

编程入门 行业动态 更新时间:2024-10-27 06:19:41
本文介绍了重新加载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路由更改,而无需手动重新启动服务器

本文发布于:2023-11-24 02:59:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623727.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路由   重新启动   加载   服务器   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!