Skip to Content
JavaScript 经典实例:第三版
book

JavaScript 经典实例:第三版

by Adam D. Scott, Matthew MacDonald, Shelley Powers
September 2022
Intermediate to advanced
585 pages
8h 17m
Chinese
China Electric Power Press Ltd.
Content preview from JavaScript 经典实例:第三版
514
19
pm2
还提供了一些其他有用的操作。
stop
停止守护进程脚本。
restart
重启守护进程脚本。
delete
删除守护进程脚本。
describe
获取指定应用的详情。
list
列出运行中的脚本。
monitor
监控日志、度量数据和应用信息。
为了方便运行
pm2
命令,可以在项目的
package.json
文件中添加一个
npm
脚本。
"scripts": {
"start": "pm2 start index.js",
}
添加这个脚本之后,在项目根目录中执
npm start
命令即可使用
pm2
动应用。
这也是很多
Node
应用云托管平台的默认行为,因此十分方便。
19.7
在本地开发过程中监控应用变化,适时重
19.7.1
问题
开发过程中事项繁多,很容易忘记在每次代码发生变化后重启应用,而且这个过程
也浪费时间。
管理
Node
515
19.7.2
方案
使用
nodemon
实用程序监控源码,发现代码有变化时重启应用。
首先,安装
nodemon
$ npm install -g nodemon
不要使用
node
启动应用,使用
nodemon
$ nodemon index.js
19.7.3
讨论
nodemon
实用程序监控启动所在目录内的文件,只要发现文件有变化就自动重启
Node
应用。这样十分方便,可以确保 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

JavaScript

JavaScript

T. J. Crowder
JavaScript

JavaScript

David Flanagan
JavaScript Patterns

JavaScript Patterns

Stoyan Stefanov

Publisher Resources

ISBN: 9787519869601