关于前端:nodemon-Node服务自动重启实时刷新

49次阅读

共计 562 个字符,预计需要花费 2 分钟才能阅读完成。

目录

  • 起步
  • 应用

nodemon作用就是实时更新,不必每次都运行一个 node <filename>

起步

  • github-nodemon
  • npm-nodemon
npm i -g nodemon

应用

nodemon <filename>

举个例子:

// 00.js
console.log("test")
nodemon .\00-parpare.js

# [nodemon] 2.0.4
# [nodemon] to restart at any time, enter `rs`
# [nodemon] watching path(s): *.*
# [nodemon] watching extensions: js,mjs,json
# [nodemon] starting `node .\00-parpare.js`
# test    ------> 输入后果

批改 00.js,无需重启

console.log("test123")
# [nodemon] clean exit - waiting for changes before restart
# [nodemon] restarting due to changes...
# [nodemon] starting `node .\00-parpare.js`
# test123   ------> 输入后果
# [nodemon] clean exit - waiting for changes before restart

正文完
 0