Home » Node.js

Nodemon Third-Party Module

In this article, we are going to learn about the Nodemon module – a third party module in Node.js (download, installation and use).
Submitted by Godwill Tetah, on June 03, 2019

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.

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.

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.

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

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

Now, let’s get started.

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

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

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:

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.

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.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.