Node.js introduction

1. Introduction to Node.js

Node.js is an extremely light weight framework for rapidly developing and deploying next generation web and mobile apps. It enables developers to have full stack development. Not only does it save lines of code, but also saves a lot of time in writing those critical code.

Node.js is built on open source Chrome V8 engine. It is built on top of C++ layer. JS(Java Script) code is compiled into machine code for blazing execution on your machine or server.

This slideshow gives a jump start and a sneak peak for node.js.


2. Download and Install

It is quite easy to download and install node.js. Installers for different platforms are given node.js official website. Download and install nodejs from following link:

https://nodejs.org/en/download/

3. Check installation

If all the things go well, open your terminal (command prompt in windows) and type node. If it shows a shell, then the installation is successful.

D:\>node
>

4. Writing a hello world program

Create a folder nodejs in your work folder. From terminal navigate to the folder.

d:\> cd <your folder path>

Create a file hello.js in your favorite text editor. Write the following code in hello.js

// say hi to the world
console.log ("Hello world with node");

 

In your terminal write the following command.

d:\work\nodejs> node hello.js
Hello world with node

You can observe this has printed the stuff which is a string in console.log.