This is a Node.js Tutorial from w3resource. You will learn About What Node.js is, History, Features,How to install Node in Windows and in Linux, Followed by a comprehensive discussion of each of the modules of Node.js API. By the end of this Tutorial, you will be able to develop and deploy Node.js Applications by yourself.
Node.js is a framework to develop highly-scalable applications which can handle tens of thousands of simultaneous client connections efficiently.
It is intended to build scalable network programs easily. So, it can be used to develop web applications accountable to high traffic.
The project received huge appreciation immediately after the demonstration and did not look back since then. It achieved exponential growth as well as adoption within a short span of time.
Unlike traditional server programs (like PHP, Java), each client connection creates an OS thread (smallest unit of processing scheduled by an operating system) which takes approximately 2Mb of memory with it. So, if you are using a system with say 4GB of RAM, a maximum number of possible concurrent connections are 2000 (i.e. 4000/2). To support more simultaneous connections, you need to increase the amount of RAM or number of systems. Which increases cost. Technically also it becomes tedious, since if you are using multiple systems to run an application, shared resources must be shared across all of the systems.
Node instead, uses event-driven programming. Each connection uses a short memory storage when the connection is requested. Node uses callbacks (a reference to an executable code or a piece of executable code) to inform the OS that a new connection is being requested. Rest of the time it does not disturb the OS. So, usage of memory is much more efficient than thread based model.
When two or more processes (an instance of a computer program that
is being executed) share the same resource, one has to be locked to
allocate the resource (like memory) to another. This can either lead to a
situation where each waiting for another to free resource (i.e.
deadlock) or you need to do write highly efficient code to manage this.
Node is free from this. It does not perform (almost) any input-output
operations directly. So, there are no locks. This makes writing codes
for Node easier.
The design of Node is influenced by Twisted of Python and Event Machine of Ruby. But unlike these, Node does not use Event Loop (is a software pattern that facilitates non-blocking I/O) as a library. It is very much part of the language itself. And there is no call to start and end the event loop also.
Though pretty young, Node.js is already being used by a lot of Organizations, Projects, and Applications. The following list is an indication of, for what kind of applications Node is being used :
Since Node is very young, lots of database drivers (required to connect to databases) and modules (for adding some specific functionality), are unstable. It is still unstable on Windows platform. But Node has a very active and responsive community and hope that these problems will be marginalized in near future.
Solve these problems: