Sign in
Log inSign up
GETTING STARTED WITH NODE JS

GETTING STARTED WITH NODE JS

Adeyemi Misturah's photo
Adeyemi Misturah
·Dec 16, 2020·

8 min read

Prerequisites

You should be familiar with JavaScript to get the most out of this Learning Path. If you’re not, but have experience with other programming languages like C++, Java, C#, PHP, Python, and so forth, you should be fine.

What is Node.js

Node.js is a cross-platform runtime environment and library for running JavaScript applications outside the browser. It is used for creating server-side and networking web applications. It is open source and free to use. It can be downloaded from this link https://nodejs.org/en/

Many of the basic modules of Node.js are written in JavaScript. Node.js is mostly used to run real-time server applications.

The definition given by its official documentation is as follows:

?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.?

Node.js also provides a rich library of various JavaScript modules to simplify the development of web applications.

Features of Node.js

Following is a list of some important features of Node.js that makes it the first choice of software architects.

  • Extremely fast: Node.js is built on Google Chrome's V8 JavaScript Engine, so its library is very fast in code execution.
  • 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. Single threaded: Node.js follows a single threaded model with event looping.
  • 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.
  • Open source: Node.js has an open source community which has produced many excellent modules to add additional capabilities to Node.js applications.
  • License: Node.js is released under the MIT license.

Who uses Node.js

Node.js is used by many large companies. Below is a list of a few of them.

  • Paypal – A lot of sites within Paypal have also started the transition onto Node.js.

  • LinkedIn - LinkedIn is using Node.js to power their Mobile Servers, which powers the iPhone, Android, and Mobile Web products.

  • Mozilla has implemented Node.js to support browser APIs which has half a billion installs.

  • eBay hosts their HTTP API service in Node.js

When to Use Node.js

Node.js is best for usage in streaming or event-based real-time applications like

  • Chat applications

  • Game servers – Fast and high-performance servers that need to processes thousands of requests at a time, then this is an ideal framework.

  • Good for collaborative environment – This is good for environments which manage documents. In a document management environment, you will have multiple people who post their documents and do constant changes by checking out and checking in documents. So Node.js is good for these environments because the event loop in Node.js can be triggered whenever documents are changed in a document managed environment.

  • Advertisement servers – Again here you could have thousands of request to pull advertisements from the central server and Node.js can be an ideal framework to handle this.

  • Streaming servers – Another ideal scenario to use Node is for multimedia streaming servers wherein clients have request's to pull different multimedia contents from this server. Node.js is good when you need high levels of concurrency but less amount of dedicated CPU time.

Best of all, since Node.js is built on javascript, it's best suited when you build client-side applications which are based on the same javascript framework.

When to not use Node.js

Node.js can be used for a lot of applications with various purposes. The only scenario where it should not be used is where there are long processing times, which is required by the application.

Node is structured to be single-threaded. If an application is required to carry out some long-running calculations in the background, it won't be able to process any other requests. As discussed above, Node.js is used best where processing needs less dedicated CPU time.

To start building your Node.js applications, the first step is the installation of the node.js framework. The Node.js framework is available for a variety of operating systems right from Windows to Ubuntu and OS X. Once the Node.js framework is installed, you can start building your first Node.js applications.

Node.js also has the ability to embedded external functionality or extended functionality by making use of custom modules. These modules have to be installed separately. An example of a module is the MongoDB module which allows you to work with MongoDB databases from your Node.js application.

To learn more about node JS look forward to my next article as we learn :

  • How to install Node.js on Windows

  • Installing NPM (Node Package Manager) on Windows

  • Running your first Hello World application in Node.js

  • And more...

At the end of this article I will like to say a big a thank you to the SheCodeAfrica team and most importantly a big ups to my assigned mentor Sharon Jebitok and my team members respectively, Thank you all for the support throughout the SCA3 mentorship journey, it has really helped my tech career!

love from Tura

Your_fav_female_Techie