How to Get Started With Node?

acknowledgement for phd thesis The face of web development today is dramatically different. The things that we can do on the web nowadays with JavaScript running on the server, as well as in the browser, were hard to imagine just several years ago, or were encapsulated within sandboxed environments like Flash or Java Applets.

What is node.js?

go As Wikipedia states: “Node.js is a packaged compilation of Google’s V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript.”.
In one sentence: Node.js shines in real-time web applications employing push technology over websockets.
we finally have web applications with real-time, two-way connections, where both the client and server can initiate communication, allowing them to exchange data freely. This is in contrast to the typical web response paradigm, where the client always initiates communication.With all of its advantages, Node.js now plays a critical role in the technology stack of many high-profile companies who depend on its unique benefits.

go to link Node itself isn’t JavaScript. Node is a program for running JavaScript, but isn’t JavaScript itself. In fact, Node is a C program. Do a directory listing on the Node/src directory and see what happens?

Why should we use node.js?

get 1. Node.js is a framework that requires Google’s JavaScript engine.
JavaScript was originally intended to be both a browser- AND server-side technology. It also explains that Node.js is a server-side implementation of JavaScript and is also single threaded.

click 2.Node.js is used to build server side applications.

stem and leaf plot homework help 3.The Node.js platform provides abstractions that make it easier to create event-driven applications.

link 4.Node.js scales on a per processor basis as well as across servers.

How to work with node.js? The main idea of Node.js: use non-blocking, event-driven I/O to remain lightweight and efficient in the face of data-intensive real-time applications that run across distributed devices. What does it really means?

go it’s a platform that fills a particular need. And understanding this is absolutely essential. You definitely don’t want to use Node.js for CPU-intensive operations; in fact, using it for heavy computation will annul nearly all of its advantages. Where Node really shines is in building fast, scalable network applications, as it’s capable of handling a huge number of simultaneous connections with high throughput, which equates to high scalability.

How it works under-the-hood is pretty interesting. Compared to traditional web-serving techniques where each connection (request) spawns a new thread, taking up system RAM and eventually maxing-out at the amount of RAM available, Node.js operates on a single-thread, using non-blocking I/O calls, allowing it to support tens of thousands of concurrent connections.

Server-side JavaScript:

The first incarnations of JavaScript lived in browsers. But this is just the context. JavaScript is a “complete” language: you can use it in many contexts and achieve everything with it you can achieve with any other “complete” language. Node.js really is just another context: it allows you to run JavaScript code in the backend, outside a browser.

In order to execute the JavaScript you intend to run in the backend, it needs to be interpreted and, well, executed. This is what Node.js does, by making use of Google’s V8 VM, the same runtime environment for JavaScript that Google Chrome uses.

Let us talk about some essential feature in node below.


Node.js uses a module architecture to simplify the creation of complex applications. Modules are akin to libraries in C, or units in Pascal. Each module contains a set of functions related to the “subject” of the module. The http module contains functions specific to HTTP. Node.js provides a few core modules out of the box to help you access files on the file system, create HTTP and TCP/UDP servers, and perform other useful functions.

Including a module is easy; simply call the require() function, like this:

var http = require('http');

In the above code, we passed the name of a module to the require() function. This causes Node to search for a node_modules folder in our application’s directory, and search for the http module in that folder. If Node does not find the node_modules folder (or the http module within it), it then looks through the global module cache. You can also specify an actual file by passing a relative or absolute path, like so:

var myModule = require('./myModule.js');

Global Scope:

Node is a JavaScript environment running in Google’s V8 JavaScript engine. As such, we should follow the best practices that we use for client-side development. For example, we should avoid putting anything into the global scope. That, however, is not always possible. The global scope in Node is GLOBAL (as opposed to window in the browser), and you can easily create a global variable of function by omitting the var keyword, like this:

globalVariable = 1;
globalFunction = function () { ... };

How to Install Node.js?

In the above we saw a little bit of node. Now let us see how to install it?
We will learn to install node on Mac, Ubuntu, and Windows.

click here Mac
If you’re using the excellent homebrew package manager, you can install node with one command: brew install node.

Otherwise, follow the below steps:

  • Install Xcode.
  • Install git.
  • Run the following commands:
git clone git:
cd node
sudo make install Ubuntu
Install the dependencies:

  • sudo apt-get install g++ curl libssl-dev apache2-utils
  • sudo apt-get install git-core
  • Run the following commands:
git clone git:
cd node
sudo make install Windows
Currently, you must use cygwin to install node. To do so, follow these steps:

Install cygwin.
Use setup.exe in the cygwin folder to install the following packages:

  • devel → openssl
  • devel → g++-gcc
  • devel → make
  • python → python
  • devel → git
  • Open the cygwin command line with Start > Cygwin > Cygwin Bash Shell.

Run the below commands to download and build node.
git clone git:
cd node
sudo make install

Hello world in Node.js

Now as you have installed node.js. Let us get to see some of the node coding in ubuntu.

At first you have to run the below code

$ apt-get install openssl libssl-dev

Create a file named test.js, and copy and paste the code below:

var http = require('http');  

var server = http.createServer(function(request, response){  
    response.writeHead(200, {  
        'Content-type' : 'text/plain'  
    response.end('hello world');  

console.log('listening on');

To start the server go to the terminal and the run the script you created by typing

$ node test.js

Now go to the browser and enter and you are ready to see the result.


In the above article we can see that although node is similar to JavaScript, but node is not. Instead node works with java script. We also get to know that every function in Node.js is asynchronous. So you can say that node.js is only an environment; you have to do everything yourself.

Although we have scratched the surface of node in this article, eventually we sure have many things to learn.

If you find this article helpful, you can connect us in  College Application Writer Visit Https Services Aamc Orgletter Writer Google+ and application for writing  Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *