Step 2

Add a new file, server.js, to the bmi-app folder.

console.log("Hello NodeJS!");

Open the terminal at the root of the project and run the following command:

node server.js

You should see the following output:

Hello NodeJS!

So far, this is not news to you! We have used node to run JavaScript files before!

Before Node, we could only use JavaScript to build applications that run inside of a browser. Every browser has a JavaScript Engine that takes your JavaScript code and turns it into an executable form. A JavaScript engine, at its core, consists of an interpreter and a runtime environment.

In 2009, Ryan Dahl took Chrome's JavaScript engine (called V8) and embedded it in a C++ program and called that program Node.

Node uses Google's V8 to convert JavaScript into byte-codes and runs it outside of a browser.

We don't have browser environment objects such as window or the document object in Node. Instead, we have other objects not available in browsers, such as objects for working with the file system, network, operating system, etc.