Basics Of Node.js

NodeJS is a JavaScript runtime eg: JVM,.NET framework, built on Google’s Chrome V8 engine.

Let us define a little more.

It is a runtime which means it converts JavaScript code to Java byte code.

  • It is built on extending the V8 engine, which is written in C++.
  • It is an open source and a cross platform.
  • It is not a JavaScript library.
  • It is event driven driven non-blocking I/O model.
  • Helps in writing the Server side code, using JavaScript.

What is event driven?

Event driven means whenever an event is triggered, it is passed to queue, which calls an event queue, which is handled by the infinite loop; i.e., event loop, where each event is handled.

Based on the event, all the tasks are performed.

What is non-blocking I/O?

Every OS works on the concept of the thread, which is used to perform multi-tasking simultaneously.

It works on single thread and works on an asynchronous model

I/O means any process such as writing to a database, reading a file connecting with the Web Services etc. and all are termed as I/O operations.

Other languages such as Java, PHP etc. use a Synronous I/O operation, which is blocking, and that’s the main advantage of using Node where it works on a Asynchronous model.

Hello world - NodeJS


What is npm-node package manager?

What is module?


Just like in Angular or in other programming languages, a module is a reusable component, which can be linked or included in the other modules with the onlythe required features which are necessary to be exposed to the outer world.

Let's create a Hello World in NodeJS.

code

What is a module in NodeJs?

Just like in Angular or in other programming languages, a module is a reusable component, which can be linked or included in other modules with only the required features, which are necessary to be exposed to the outer world.

code

Different ways of creating a Module

code

Module - NodeJSTip : Node.js is one of the top four languages which are used in the Cloud nowadays.

These are some of the basics, which every developer starting to learn NodeJS should know. I will keep posting more articles on nodejs and will try to make this nodejs more simple and easy to understand.

Ebook Download
View all
Learn
View all