What is Node.js?

Node.js Developers

Node.js is a software platform which functions at the server-side level and has been designed for writing Internet-based applications with maximized scalability. Programs are written in JavaScript using a form of processing called I/O, (Input/Output) which allows other functionality to continue processing before the program’s transmission is complete. Huh?! In other words, Node.js is a system for receiving and responding to HTTP requests using JavaScript. It is intended for running independent JavaScript programs, which are files on the server rather than files referenced by HTML. A basic example is noted on the Nodejs.org website, in which the server responds to every request with the text “Hello There World”: var http = require(‘http’); http.createServer(function (req, res) { res.writeHead(200, {‘Content-Type’: ‘text/plain’}); res.end(‘Hello There World ‘); }).listen(1337, ‘’); console.log(‘Server running at’); To run the server, put the code into a file example.js and execute it with the node program from the command line: % node example.js Server running at Here is an example of a simple TCP server listening on port 1234 and will echo whatever you send it: var net = require(‘net’); var server = net.createServer(function (socket) { socket.write(‘Echo server ‘); socket.pipe(socket); }); server.listen(1234, ‘’); Node was developed in 2009 and is in ongoing development. The original goal of the platform was to create web sites with push capacities seen in web applications (like Gmail or eBay). One of the most popular uses for Node.js is building web servers, due to its event-driven programming.


Ok, so what is Event-driven Programming?


Traditional web servers not built with a platform like Node.js are thread-based systems, which means you wait for a function to be called until it is 100% complete and loads in your browser. If you launch a traditional web server and it starts receiving connections, it will hold each connection open until it has performed the request to completion. Sometimes, this can take a few microseconds during which the server is blocking that I/O function. This can cause slow loading, and the only way to scale a thread-based system is to add more servers performing web application functions. Event-based systems on the other hand, are able to take your request and process it while simultaneously taking other requests. So you launch the event-driven web server, which starts receiving connections, and as it accepts the request, it moves to the next request immediately. When the original request is complete, the results are returned. This is also known as a “non-blocking I/O” as it is allowing another process to continue before completing the initial transmission. This system is highly scalable and you can add more servers performing web application functions but at a much lower rate than necessary with a thread-based system.


Why is Node.js becoming so popular?


In addition to the user speed and scalability of event-driven programming that can be developed with Node.js, it is written in JavaScript, which is one of the most common web languages to software developers. Because it is such a common language it is easy for developers to create fast and scalable servers. The Node community is an open-source resource for developers and is constantly growing and expanding. Node.js uses module architecture to simplify the creation of complex applications, which means that each module (encapsulated pieces of code) can simply be extracted and reused instead of rebuilt. Initially with the installation and learning curve, Node.js requires some extra work but the rewards quickly add up with fast, robust and scalable application development. It has become popular as a result with high-load applications on websites like Microsoft, eBay and Yahoo and runs on the Microsoft Azure platform.

By Mary MacPherson

Share this article

Related Posts