Introduction to Node.js for Beginner Developers

What is Node.js ?

Node.js is an open source, cross-platform runtime environment for developing networking application. 

It uses the Google JavaScript V8 Engine to execute code.

Node.js is not a framework and it’s not a programming language. it is use for building back-end services like APIs.

It is used in production by companies like Netflix, Uber, Paypal etc.

Node.js = Runtime Environment + JavaScript Library

Table of Contents

What are the key features of Node.js ?

There are other languages also which we can use to build back-end services like Python, Ruby, C# so what makes Node.js different.

  1. It provides fast and highly scalable services compare to others.
  2. It has large ecosystem for open source library.
  3. It’s use JS everywhere, so it is easy for JS developer to build back-end services using Node.js.
  4. Source code is cleaner and consistent.
  5. It provides fast services.
Concepts

This diagram saw us some important parts of Node.js

How to Download Node.js ?

You can download and install Node.js from the official web site nodejs.org .

You can use Visual Studio Code as a code editor to write Node.js code.

You can download and install vs code from code.visualstudio.com .

Node.js architecture

The mechanics of node.js are contributes to its popularity among the developers. whereas most alternative runtime environment utilize multi-threaded processing models, node.js does it all in a single thread.

In multi-threaded processing setups, each server has a limited thread pool it can access. So every time a server receives a request, it pulls a thread from the pool and assigns it to that request, to take care of processing it. In this case, the processing is synchronous and sequential, which means that one operation is performed at a time. It is slow and inefficient. It can particularly became a problem if application has to deal with a high number of client requests.

Node.js uses single-threaded processing. It is fast and efficient compare to multi-threaded processing because in this process architectures process every request using a single main thread, utilizing event loops to run blocking Input/Output operations in a non-blocking way.

Modules in Node.js

Node.js features have modules that are kept in individual contexts so they don’t interfere with other modules of node.js.

A modules in node.js are either simple or complex which is organized in JS files and reusable throughout the node.js application.

There are three types of module in node.js : Core, Local and Third party.

  1. Core Module : It include the basic, bare-bones functionalities of Node.js. They load automatically when a node process starts and are part of Node.js’s binary distribution.
  2. Local Module : this are created within the node.js application. They include different and additional functionalities in separate files to core functionality package. It can also be packaged and distributed for use by the node.js community.
  3. Third party Module : It is an existing code written by a third party. It can be imported into your node.js application to expand or add different features and functions.

Like the article? Spread the word

This could be also interesting