NodeJS

Important Concepts in NodeJS

The following list provides some of the Important Concepts in NodeJS that every programmer should know.

  • Modules in NodeJS
  • NodeJS File System
  • Events
  • Node Package Manager (NPM)
  • Callbacks
  • Asynchronous I/O (Non-Blocking I/O)
  • Promises
  • Prototypes

Brief Introduction of Important Concepts in NodeJS

The following section provides a brief introduction of the above-mentioned concepts.

Modules

In fact, NodeJS offers lots of built-in functionality that we can use in our code. Actually these are a set of libraries available in the form of modules.

File System in NodeJS

In fact, the file system in NodeJS is available as a module called ‘fs’. It allows us to read, write and modify the files.

Events

Similarly, NodeJS has a module called as ‘events’ that enable us to do event-driven programming.

Node Package Manager (NPM)

In order to download the packages available in NodeJS, we use Node Package Manager (NPM).

Callbacks

Basically, a callback function is a function that we can pass as an argument to another function. Once, we pass a function as callback, it runs within the function to which it is passed.

Asynchronous I/O in NodeJS

It makes JavaScript execute fast. So, the NodeJS function doesn’t keep incoming requests waiting till the current request is finished. Instead, it accepts other incoming requests while the previous requests are being processed asynchronously.

Promises in NodeJS

Since, we can use asynchronous function calls in NodeJS, so we also need a placeholder for a future return value. Hence, a Promise in NodeJS serves the purpose of the placeholder that will accommodate the result of the asynchronous task. Basically, a Promise is an object that has two properties – state and result.

Prototypes

For the purpose of creating custom objects in JavaScript, we need prototypes.


Further Reading

Understanding NodeJS With Examples

programmingempire

Princites

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *