Introduction to Node.js

Introduction to Node.js

In 2009 Ryan Dahl was developed the Node.js. Now latest version is 12.16.1(includes npm 6.13.4). According to the official documentation of Node.js, it describe as follows-

Fig 1: Definition of Node.js in Official documentation

Node.js is cross-platform run time environment for developing server side and as well as networking application.Also it is open source.Node.ja application are written in JS and can run within the Node.js runtime on OS X, Linux and windows.Also it’s provide library of various javascript modules.

Node.js = Run Time Environment + JavaScript Library

Fig 2: Concept of Node.js
Resources : Download Node.js

Node.js Features

  • Fast : In code execution Node.js library is very fast
  • Single Thread still Scalable : with event looping Node.js uses a single threaded model. It use non-blocking way and It makes the makes the server highly scalable.
  • Asynchronous and Event Driven
  • No Buffering
  • License

Places that can use Node.js

Fig 3: Use cases
  • SPA : Single Page Aplication
  • DIRT : Data Intensive Real-time Applications
  • Data Streaming Application
  • I/O bound Application
  • JSON APIs based application
Node.js ‘Hello world’ Example :
  1. First download and install the node.js in your computer.
  2. Then create a ”Test.js” Node.js file
  3. Add following code to the Test.js
Fig 4:Code segment
  1. After Open “Command Prompt”.
  2. Then navigate to the folder that contain “Test.js”.
Fig 5: Navigate to the folder
  1. Then type “node Test.js”
Fig 6: start server
  1. Now your computer act as a server.If anyone tries to access port 8080 they will get “Hello World!” message.
Thank You!

Leave a comment