NodeJS Series #3: Using External Files

Standard

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:

console.log("Poooff");

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:

node5

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

node6

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s