What's this Node.js and npm?

I’ve been using this heavily for the past few months and I got a vague idea about what they are. So I’ll better write a bit about this to see if I can explain it to myself.

I’ll start with Node.js because it’s a piece a software that you can download and install in the old fashioned way – and along the way you get a npm client.
As the Node.js homepage states, it’s a JavaScript run-time engine. So instead of using a browser and a html page to run a piece of JavaScript, you can just pass it directly to Node.js.
A hello world application using Node would be something like this:
console.log('Hello World!);
Save the above line in a file named helloWorld.js and from the command line run:
node helloWorld.js
And you promptly get back:
Hello World!
This is lot easier to digest rather than the JDeveloper Tutorial I spent a day on few months back.
So what’s so special about this? You can do this in bat file with just:
echo Hello World
Well, that’s where npm comes in.

Npm stands for »Node Packages Manager« and is basically a repository for open source JavaScript modules.
Like any any proper open source repository, npm has a bunch of hello world’s.
So here is how we can use one called »console-log-hello-world«  Start by typing:
npm install console-log-hello-world
The prompt will return few warning messages, but by typing:
npm list
The package will show up as installed:
└── console-log-hello-world@1.0.3
To use the package create a file called »helloNpmWorld.js« with the following line:
require("console-log-hello-world");
And run it with:
node helloNpmWorld.js
For the prompt return of:
Hello World
Npm is not just massive, with somewhere north of 350k modules, but some of it’s contributors are among the world’s biggest companies like Google and Facebook.
And that’s where it becomes interesting!