Getting Started With Node.js : A Begginers Guide

Getting Started With Node.js : A Begginers Guide

Howdy coders, In this post we are going to understand some basics of the Nodejs framework

So, let’s get started…

What is Node.js?

Nodejs is an Open source and cross-platform runtime environment for executing JavaScript code outside of the browser.

In other words, NodeJS is a platform which allows you to build scalable network application using JavaScript on the server side

NodeJS is not programming language but it’s a platform where you can run JavaScript on server

Node.js Was Created by ‘Ryan Dahl

Prerequisites

  • Basic understanding of javascript
  • Basic Knowledge of Ajax, HTML, CSS and other web technologies will be good

Node.js Features:

  • Node.js is Great for prototyping and agile development.
  • Node is ideal for making highly-scalable, data-intensive and real-time apps.
  • Its used for production in large companies like Flipkart, uber, Netflix, Walmart and so on.
  • Nodejs uses JavaScript everywhere, so we don’t need to learn any extra languages to dive in.
  • Using node.js we can make Cleaner and more consistent codebase
  • Nodejs has the Large ecosystem of open source libs which we make development process very faster
  • Node.js is making use of the Google Chrome V8 runtime engine
  • V8 is written in c++ and that is why it is very fast.
  • Node applications are single-threaded. That means a single thread is used to serve all clients.
  • Node applications are asynchronous or non-blocking by default. That means when the application involves I/O operations (eg accessing the file system or the network), the thread doesn’t wait (or block) for the result of the operation. It is released to serve other clients
  • Node.js use event loop is single-threaded by nature. But most the I/O (network, filesystem, etc) is run on separate threads because the I/O APIs in Node.js are asynchronous/non-blocking.

 Benefits of using NodeJS:

Organizations are making use of Node.js because of following reasons:

  • Write all code in JavaScript
  • Easy to modify and maintain
  • Faster Development time
  • Better Performance because of Non-Blocking or Asynchronous I/O
  • Every day more than 500 new packages are published to NPM everyday

What is the V8 Engine and How it makes node.js faster?

V8 is an open source engine written in C++. 

Rather than treating each JavaScript object as having its own separate class, V8 adds a hidden class that identifies common properties between those objects.

V8 translate the JavaScript code into Machine code. the computer processor can read machine code directly.   Without this, your browser would have to translate each piece of JavaScript into machine code every time you run a   script on a web page.

V8 has better garbage collection, which means that when it finishes using memory for one task, it can better reclaim that memory for another task.

So Because of these reasons, it makes javascript faster.

Which types of application can we build using Node.js?

  • I/O Application
  • Data Streaming Applications
  • Data Intensive Realtime Applications
  • JSON APIs based Applications
  • Single Page Applications
  • Real-Time Web Application like (Chat, Video Streaming, etc…)
  • Network applications
  • General purpose applications
  • IOT Applications.

When not to Use NodeJS:

You should avoid using Node for CPU-intensive applications, such as a Heavy image manipulaton,video encoding/conversion service or file compression because while executing these operations, other clients have to wait for the single thread to finish its job and be ready to serve them.

NOTE : In Node, we don’t have browser environment objects such as window or the document object. Instead, we have other objects that are not available in browsers, such as objects for working with the file system, network, operating system, etc.

Conclusion:

Thanks for reading. in this post, we have covered some basic introduction of node js so, its good to have some basic knowledge of node.js before we dive into some advanced topic.

Do let me know If you face any difficulties please feel free to comment below we love to help you. if you have any feedback suggestion then please inform us by commenting.

Don’t forget to share this tutorial with your friends on facebook, and twitter

Subscribe to our Newsletter

Stay up to date! Get all the latest posts delivered straight to your inbox.

If You Appreciate What We Do Here On TutsCoder, You Should Consider:

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Leave a Comment