Hello World in Node.js - Part 1 - Introduction

Node.js is a standalone implementation of Javascript using Google Chrome’s v8 engine. Although Node.js can be used in a lot of ways, Node.js has found a lot of popularity on the server side. Node.js has a great package manager called ‘Node Package Manager(NPM)’. The community has created countless libraries and frameworks, and all can be fetched through npm.

Learning Node.js can make a lot of sense if you are already familiar with Javascript. Even if you are new to Javascript, you can directly begin your learning journey with Node.js. Although I won’t be covering basics of Javascript here.

Installing Node.js

Node.js can be downloaded from its official website. Steps to install it are pretty much the same as you would have installed any other application on your system. Node.js is supported on all major platforms including Windows, Linux & Mac OS. Make sure node and npm commands are available in your terminal or command prompt.

Creating a Project

Starting in Node.js is easy. You can start by creating a plain javascript file and executing it with node command. For example:

  • Create index.js and put the following in it

    1
    console.log("Hello, World!");
  • Execute index.js in terminal

    1
    node index.js
  • Output

    1
    Hello, World

Tada!!! You created your first Node.js Hello World Program.

Next

Let’s continue to Part 2, where we are going to discuss about NPM.