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?
Node.js Was Created by ‘Ryan Dahl’
- Basic Knowledge of Ajax, HTML, CSS and other web technologies will be good
- 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.
- 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 ﬁle 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:
- 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++.
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.
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.
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.