nodemon_Nodemon第三方模块

nodemon

Hello friends, don’t tell me you aren’t tired of opening command prompt every second to type node app.js whenever you make changes to your code.

朋友们,您好,不要告诉我您对代码进行更改时不需每秒打开命令提示符来键入nodeapp.js

It’s annoying at times, right?

有时候很烦,对不对?

Today, let’s see a third party app that helps us avoid visiting the console all the time after making changes on our code...

今天,让我们来看一个第三方应用程序,它可以帮助我们避免在对代码进行更改之后一直访问控制台...

Like said before, Node modules are like libraries which help us perform specific tasks. Node JS is always considered powerful because it has a very large ecosystem of third-party modules.

如前所述,Node模块就像是可以帮助我们执行特定任务的库。 节点JS一直被认为是功能强大的,因为它具有非常大的第三方模块生态系统。

The NODEMON module is a third-party module built by some experts to help us avoid the stress of visiting that ugly command line all the time just to type 2 words.

NODEMON模块是由一些专家构建的第三方模块,可帮助我们避免仅输入2个单词就一直访问丑陋命令行的压力。

Take Note! You should have Node js in your PC.

做记录! 您的PC中应该有Node js。

With Node js already up and running, let’s get started.

Node Node js已经启动并运行,让我们开始吧。

Now, let’s get started.

现在,让我们开始吧。

First of all, install the nodemon module by typing npm install nodemon on the command line,

首先,通过在命令行上键入npm install nodemon来安装nodemon 模块

nodemon module download and use step 1

Wait for a while as it downloads.
NB: Internet required!

等待下载。
注意:需要互联网!

Here is how it works...

下面是它的工作原理...

After creating your wonderful node app, no need using node app.js again, rather use nodemon app or nodemon app.js

创建出色的节点应用程序后,无需再次使用node app.js,而应使用nodemon app或nodemon app.js

This module automatically detects new changes or updates in your source code file and then initiates the file again immediately after it’s saved.

该模块会自动检测源代码文件中的新更改或更新,然后在保存文件后立即再次启动该文件。

Let’s see,

让我们来看看,

Open a text editor and type the following code and save it with the file name app.js:

打开一个文本编辑器,输入以下代码,并将其保存为文件名app.js

const os = require('os'); 
console.log("Platform: " + os.platform());
console.log("Architecture: " + os.arch());
console.log (" Free memory: "  + os.freemem() );


//console.log("Host name: " + os.hostname());


The file should be saved in your default Node.js directory.

该文件应保存在默认的Node.js目录中。

One line of code has been left as comment. It’ll serve as an update to our code later.

剩下一行代码作为注释。 稍后将用作我们代码的更新。

nodemon module download and use step 2

Our app just started and the output displayed on our console.

我们的应用程序刚刚启动,输出显示在控制台上。

Let’s update the code and see how it automatically outputs the result of the last line of code.

让我们更新代码,看看它如何自动输出最后一行代码的结果。

nodemon module download and use step 3
nodemon module download and use step 4

Thanks for coding with me. Your comments are most welcome.

感谢您与我一起编码。 非常欢迎您发表评论。

翻译自: https://www.includehelp.com/node-js/nodemon-third-party-module.aspx

nodemon

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值