Node Js Introduction - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript Node Js Introduction - Supercoders | Web Development and Design | Tutorial for Java, PHP, HTML, Javascript

Breaking

Post Top Ad

Post Top Ad

Sunday, November 25, 2018

Node Js Introduction

Node Js Introduction



Introduction

Node.js was originally written by Ryan Dahl in 2009, about thirteen years after the introduction of the first server-side JavaScript environment, Netscape's LiveWire Pro Web. The initial release supported only Linux and Mac OS X. Its development and maintenance was led by Dahl and later sponsored by Joyent. 

Node.js (Node) is an open source development platform for executing JavaScript code server-side. Node is useful for developing applications that require a persistent connection from the browser to the server and is often used for real-time applications such as chat, news feeds and web push notifications.

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. 


How Node Js Works




Node.js is intended to run on a dedicated HTTPserver and to employ a single thread with one process at a time. Node.js applications are event-based and run asynchronously. Code built on the Node platform does not follow the traditional model of receive, process, send, wait, receive. Instead, Node processes incoming requests in a constant event stack and sends small requests one after the other without waiting for responses.
This is a shift away from mainstream models that run larger, more complex processes and run several threads concurrently, with each thread waiting for its appropriate response before moving on.

Features of Node Js





Following is a list of some important features of Node Js

  1. Extremely fast: Node.js is built on Google Chrome's V8 JavaScript Engine, so its library is very fast in code execution.
  2. I/O is Asynchronous and Event Driven: All APIs of Node.js library are asynchronous i.e. non-blocking. So a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call. It is also a reason that it is very fast.
  3. Single threaded: Node.js follows a single threaded model with event looping.
  4. Open source: Node.js has an open source community which has produced many excellent modules to add additional capabilities to Node.js applications.
  5. License: Node.js is released under the MIT license.
  6. Highly Scalable: Node.js is highly scalable because event mechanism helps the server to respond in a non-blocking way.
No buffering: Node.js cuts down the overall processing time while uploading audio and video files. Node.js applications never buffer any data. These applications simply output the data in chunks.

Node.js frameworks and tools



Node.js is a low-level platform, and to make things easier and more interesting for developers thousands of libraries were built upon Node.js.

Many of those established over time as popular options. Here is a non-comprehensive list to
the ones I consider very relevant and worth learning:

Micro, a very lightweight server to create asynchronous HTTP microservices. 

Socket.io, a real-time communication engine to build network applications.

koa, built by the same team behind Express, aims to be even simpler and smaller,
building on top of years of knowledge. The new project born out of the need to create
incompatible changes without disrupting the existing community.

Next.js, a framework to render server-side rendered React applications.

Express, one of the most simple yet powerful ways to create a web server. Its minimalist
approach, unopinionated, focused on the core features of a server, is key to its success.

Meteor, an incredibly powerful full-stack framework, powering you with an isomorphic
approach to building apps with JavaScript, sharing code on the client and the server.
Once an off-the-shelf tool that provided everything, now integrates with frontend libs
React, Vue and Angular. Can be used to create mobile apps as well.

How to install Node in window

  1. Download the Windows installer from the Nodes.js® web site.
  2. Run the installer (the .msi file you downloaded in the previous step.)
  3. Follow the prompts in the installer (Accept the license agreement, click the NEXT button a bunch of times and accept the default installation settings).
  4. Restart your computer. You won’t be able to run Node.js® until you restart your computer.

How to Install Node in ubuntu


Ubuntu 16.04 contains a version of Node.js in its default repositories that can be used to easily provide a consistent experience across multiple systems. At the time of writing, the version in the repositories is v4.2.6. This will not be the latest version, but it should be quite stable and sufficient for quick experimentation with the language.
In order to get this version, we just have to use the apt package manager. We should refresh our local package index first, and then install from the repositories:
  • sudo apt-get update
  • sudo apt-get install nodejs
If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you'll also want to also install npm, which is the Node.js package manager. You can do this by typing:
  • sudo apt-get install npm
This will allow you to easily install modules and packages to use with Node.js.
Because of a conflict with another package, the executable from the Ubuntu repositories is called nodejsinstead of node. Keep this in mind as you are running software.
To check which version of Node.js you have installed after these initial steps, type:
  • nodejs -v
Once you have established which version of Node.js you have installed from the Ubuntu repositories, you can decide whether or not you would like to work with different versions, package archives, or version managers. Next, we'll discuss these elements along with more flexible and robust methods of installation.

No comments:

Post a Comment

Post Top Ad