Skip to main content

Posts

Process Object in Node JS

             Node JS offers several Inbuilt core objects. Here we gonna discuss about one of the important Core Object - Process . The process object is a global object and can be accessed from anywhere. Here I have listed out few Methods and properties of an Object. Process Events Event: 'exit' Emitted when the process is about to exit. There is no way to prevent the exiting of the event loop at this point, and once all exit listeners have finished running the process will exit. Therefore you must only perform synchronous operations in this handler. process.on( 'exit' , function (code) { // Sync function only      console .log( 'About to exit with code:' , code); }); Event: 'beforeExit' This event is emitted when node empties it's event loop and has nothing else to schedule. Normally, node exits when there is no work scheduled, but a listener for 'beforeExit' can make asynchronous calls, and cause no...
Recent posts

Node JS Module Types and Tutorials

Node Module Types Node.js modules are generally categorized by 3 Types. 1.      Core Modules 2.      Local Modules 3.      Third Party Modules Node.js Core Modules: Node.js is a light weight framework. The core modules include bare minimum functionalities of Node.js. These core modules are load automatically when Node.js process starts. However, you need to import the core module first in order to use it in your application. Loading Core Modules: In order to use Node.js core or NPM modules, you first need to import it using require() function as shown below. var module = require('module_name'); As per above syntax, specify the module name in the require() function. The require() function will return an object, function, property or any other JavaScript type, depending on what the specified module returns. Node.js Local Module: Local modules are modules created locally in your Node.j...

Node JS Introduction

Node js Introduction: 1.      Node.js is a server-side platform built on Google Chrome's JavaScript Engine (V8 Engine). 2.      cross-platform runtime environment used for development of server-side web applications. 3.      Node.js applications are written in JavaScript and can be run on a wide variety of operating systems. 4.      Node.js is based on an event-driven. 5.      Non-blocking Input/Output. 6.      Node.js also thousands of JavaScript modules which simplifies the development of web applications called as NPM. 7.      Single thread process. Reasons to choose Node js? 1.      Node uses the V8 JavaScript Runtime engine , the one which is used by Google Chrome. 2.      Asynchronous event driven IO helps concurrent request handling .This feature basically means that if ...