Basic Introduction & An Overview of Node.js


Ifourtechnolab

Uploaded on Oct 10, 2019

Category Technology

Node.js is an open source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows and Linux.

Category Technology

Comments

                     

Basic Introduction & An Overview of Node.js

  iFour NCodnesu.jsltancy   https://www.ifourtechnolab.com/nodejs-blockchain-software-development Introduction to Node JS  What is Node.js?  Node.js is an open source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux.  Node.js also provides a rich library of various JavaScript modules which simplifies the development of web applications using Node.js to a great extent. https://www.ifourtechnolab.com/nodejs-blockchain-software-development What Can Node.js Do?  Node.js can generate dynamic page content  Node.js can create, open, read, write, delete, and close files on the server  Node.js can collect form data  Node.js can add, delete, modify data in your database https://www.ifourtechnolab.com/nodejs-blockchain-software-development Advantages of Node JS  Node.js offers an Easy Scalability  Easy to Learn  Node.js is used as a Single Programming Language  The Benefit of Fullstack JS  Known for Offering High Performance  The Support of Large and Active Community  The Advantage of Caching  Offers the Freedom to Develop Apps  Getting Support for Commonly Used Tools  Handles the Requests Simultaneously  Node.js is Highly Extensible https://www.ifourtechnolab.com/nodejs-blockchain-software-development Features of Node.js  Extremely fast  I/O is Asynchronous and Event Driven  Single threaded  Highly Scalable  No buffering  Open source  License https://www.ifourtechnolab.com/nodejs-blockchain-software-development Traditional Web Server Model  In the traditional web server model, each request is handled by a dedicated thread from the thread pool. If no thread is available in the thread pool at any point of time then the request waits till the next available thread. Dedicated thread executes a particular request and does not return to thread pool until it completes the execution and returns a response. https://www.ifourtechnolab.com/nodejs-blockchain-software-development Node.js Process Model https://www.ifourtechnolab.com/nodejs-blockchain-software-development Node.js Process Model Node.js processes user requests differently when compared to a traditional web server model. Node.js runs in a single process and the application code runs in a single thread and thereby needs less resources than other platforms. All the user requests to your web application will be handled by a single thread and all the I/O work or long running job is performed asynchronously for a particular request. So, this single thread doesn't have to wait for the request to complete and is free to handle the next request. When asynchronous I/O work completes then it processes the request further and sends the response. An event loop is constantly watching for the events to be raised for an asynchronous job and executing callback function when the job completes. Internally, Node.js uses libev for the event loop which in turn uses internal C++ thread pool to provide asynchronous I/O. https://www.ifourtechnolab.com/nodejs-blockchain-software-development Setup Dev Environment Download Node.js: The official Node.js website has installation instructions for Node.js: https://nodejs.org  here is the print 'hello world' code in node.js: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(8080); https://www.ifourtechnolab.com/nodejs-blockchain-software-development Setup Dev Environment create new.js file in Visual studio code: In Node.js file extension is same as javascript ( .js ). https://www.ifourtechnolab.com/nodejs-blockchain-software-development How to Run node file  Set file location on Terminal or Cmd:  using node filename.js to run file in Cmd or Terminal: https://www.ifourtechnolab.com/nodejs-blockchain-software-development  how to run Node.js file:  In browser search http://localhost:(given port) https://www.ifourtechnolab.com/nodejs-blockchain-software-development