What is Node.js ? - AkuCode
Node. JS is software
designed to develop web-based applications and is written in the syntax of the
JavaScript programming language. If during this time we know JavaScript as a
programming language that runs on the client/browser side only, then Node. JS
exists to complement the JavaScript role so it can also apply as a programming
language running on the server-side, just like PHP, Ruby, Perl, and so on.
Node. JS can run on Windows, Mac OS X and Linux operating systems without the
need for any program code changes. Node. JS has its own HTTP server libraries
so it is possible to run a Web server without using a Web server program such
as Apache or Nginx.
To execute Javascript
as the server language required a fast engine and has good performance.
Google's Javascript engine named V8 is used by Node.js it is also the engine used by the Google Chrome browser.
Unlike the server-side
programming language in general blocking, Node. JS is non-blocking, as
JavaScript works. Node. JS runs on an event-driven basis. The intention of
Blocking is simply that a program code will be executed until it is completed,
and then switch to the next program code.
Suppose we have a
program with the following algorithm:
· Accept
the request for the blog page
· Retrieve
blog data from a database
· Write
HTML contains blog data
· Send
response to Client
If we use a multi-threaded blocking programming language, the second point when the program
retrieves data from the database for a certain period of time on a thread,
another thread is set up to run the third point (i.e. writing data from the
database into the HTML form) will not be executed until the thread for the second bullet returns the data. This is actually not a problem because the CPU
runs the process very quickly. Just that, Node. JS with its single-threaded
performs differently.
Node. js, instead of
allocating the thread for each point, it will only create threads only when an event requires it. For example, when the program fetches data from a database,
the program will only create threads or in other words start processing the
third point only when data from the database is received, using callbacks. In
addition, if there are other processes that are not dependent on that data,
then the process will be executed without having to wait for the data retrieval
to be completed.
Who is the first time Node.js maker?
Node. JS was first created and introduced
by Ryan Dahl, in 2009 so JavaScript could be used as a server-side programming
language, a classmate with PHP, ASP, C#, Ruby and so on. Ryan Dahl is a developer
of Joyent who is a software company and Cloud infrastructure. He had an
interest in the single-threaded implementation of the server-side programming
language and eventually chose JavaScript as the language for Node, having
previously tried to use Haskell, Lua, and C.
Advantages of using
Node. Js
· Node.js
uses the claimed JavaScript programming language as the most popular and widely
known programming language for the wider community
· Node.js
is capable of handling thousands of connections along with the minimum resource
usage for each process
· Node.js
is especially reliable for creating real-time applications
· Node.js
is an open-source project, so anyone can see the code structure and can also
contribute to its development
· Server-side
JavaScript and also client minimizes discrepancies between two sides of a
programming environment, such as related data communication which uses the same
JSON structure on both sides, the same form validation that can be executed
Server and client-side, etc.
· NoSQL
databases such as MongoDB and CouchDB support direct Javascript so that
interfacing with this database will be much easier.
· Node.js
uses the V8 which always follows the development of the ECMAScript standard
(the official standard name of JavaScript, but JavaScript is better known in
its implementation), so there is no need for any concern that the browser does
not support the features in Node.js.
Comments