Blog Archives

How process.nextTick() works in Node.js?

Tweet The process object is a one of the few global objects provided by the Node.js core API. It can be access from anywhere, thus its methods can also be accessed. Such is a method called process.nextTick() which is used

Posted in Node.Js

Node.js Update

Tweet To update node to latest version, you can install n sudo npm install -g n Then just : sudo n latest Result will be like : dileep@dileep:~/Desktop/node$ sudo n latest install : node-v8.4.0 mkdir : /usr/local/n/versions/node/8.4.0 fetch : https://nodejs.org/dist/v8.4.0/node-v8.4.0-linux-x64.tar.gz

Posted in Node.Js

Jade Tags ?

Tweet Any text at the beginning of a line—by default—is interpreted as an HTML tag. The main advantage of Jade is that this text renders both closing and opening tags for the HTML element, as well as the symbols. Therefore,

Posted in Jade Tagged with:

Middleware

Tweet we have used existing middleware (body-parser, cookie-parser, static, and connect-session, to name a few), and we’ve even written some of our own (when we check for the presence of &test=1 in the querystring, and our 404 handler). But what

Posted in Express, Node.Js Tagged with: ,

Developing template engines for Express

Tweet To develop template engines for Express ,Use the app.engine(ext, callback) method to create your own template engine. ext refers to the file extension, callback is the template engine function which accepts the location of the file, the options object,

Posted in Express, Node.Js Tagged with: ,

Response Object ?

Tweet The response object (which is normally passed to a callback, meaning you can name it whatever you want: it is common to name it res, resp, or response) starts its life as an instance of http.ServerResponse, a core Node

Posted in Express, Node.Js

Request Object ?

Tweet The Request Object The request object (which is normally passed to a callback, meaning you can name it whatever you want: it is common to name it req or request) starts its life as an instance of http.IncomingMessage, a

Posted in Express, Node.Js Tagged with: ,

Cluster ?

Tweet A single instance of Node runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node processes to handle the load. The cluster module allows you to easily

Posted in Node.Js Tagged with:

Return the response from ajax call ?

Tweet Return the response from ajax call ? : The A in AJAX stands for asynchronous. That means sending the request (or rather receiving the response) is taken out of the normal execution flow. Synchronous : Imagine you make a

Posted in Snippets

HOISTING in JavaScript

Tweet HOISTING in JavaScript :All JavaScript variables are hoist at the top of the scope (function) in which they are defined. To understand it consider the code snippet shows below, var foo = "foo"; console.log(foo); Above code will print foo

Posted in Javascript