NodeJS Series #3: Using External Files

Sharing is Caring

Hello Wizards,

This time we will create external .js files to call from NodeJS Command Prompt.

Create a new .js file (for instance I’ve created sample.js).
Add these javascript lines as an example:

[sourcecode language=”javascript”]

When we call external file from nodejs command prompt,it shall write “Pooff” as an output.

Store this file to a close destination,easy to access later from command prompt.Now open “Nodejs Command Prompt” application and call this:


Then press enter and see what happens.According to me,I get this one:


Its that easy to call external files with Nodejs.

Do you want much more complicated and real-life solution? Wait for tomorrow, Wizards 🙂

I shall show you how to listen to a port tomorrow.