table of contents introduction setting up the project server watcher bringing the pieces together references you can find source code here:...
本文介绍了如何创建一个类似nodemon的node.js服务器自动重启工具。首先,初始化项目并设置es6支持,然后创建基本服务器。接着,使用node.js的child_process和fs/promises模块编写监视器,检测javascript文件变化时自动重启服务器。通过npm脚本,简化启动和开发。该工具可扩展监控其他文件类型或执行不同命令。