What is Node.js Exactly? - a beginners introduction to Nodejs

NodeJS explained

In it's simplest form, NodeJS is just javascript with the capability of running in your computer without a web browser. As a result of its capability to run on a computer, NodeJS can also access the computer file systems, databases, network protocols, etc without the need of server programming languages like PHP or Python. What that means is anything you can do with PHP or Ruby, now you can just do it with JS. All these capabilities were made possible by using the chrome JS engine called V8, which now runs on your computer without a browser.

Important facts about NodeJS

  • Node.js is an open source server environment
  • Node.js is free
  • Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • Node.js uses JavaScript on the server

The difference with PHP/Python/ASP and NodeJS

Why would you want to use NodeJS when you have all these server-side programming languages at your disposal? A simple illustration of how those server-side programming languages and NodeJS responds to a typical request can answer that.

Here is how PHP, Python or ASP handles a file request:

  • Sends the task to the computer's file system.
  • Waits while the file system opens and reads the file.
  • Returns the content to the client.
  • Ready to handle the next request.

Here is how Node.js simplifies exactly the same request:

  • Sends the task to the computer's file system.
  • Ready to handle the next request.
  • When the file system has opened and read the file, the server returns the content to the client.

Also, Node.js runs single-threaded, non-blocking, asynchronously programming, which is very memory efficient.

What can we do with NodeJS

NodeJS is capable of doing a number of things which includes

  • Listening to HTTP request,
  • Generating dynamic page content,
  • Manipulate files on a server,
  • Collect and store application form data,
  • Store data into a database etc.

As a result of these capabilities NodeJS is mostly use used to:

1. Build utilities.

Utilities for development, including gulp, grunt, Webpack etc are built with NodeJS. These tools help us to automate painful or time-consuming tasks in your development workflow like minification, compilation, unit testing, linting, etc.

2. Building Web Servers

Web servers like Express framework and Koa are built with just JS and they enable us to build web-based applications with just js. These frameworks provide HTTP utility methods and middleware and make creating a robust API quick and easy.

Getting started with NodeJS

It is very easy to get started with NodeJS and this video shows you that with a very easy example.

Subscribe for coding videos

Keep growing professionally with just three curated videos weekly.

We hate spam as much as you do.