Blog Archives

Node JS to Deliver HTML Files

Tweet Node JS to Deliver HTML Files: The HTTP module is used to start up HTTP servers and respond to HTTP requests from users. The fs module is used to read the file system.Node js to deliver the html file

Posted in Express, Node.Js Tagged with:

Express JS to Deliver HTML Files

Tweet How to load and “display” a basic HTML file : There are many ways to simply send the html file using the node’s core api of using the readfile,but the easy way to do is using the Express Framework

Posted in Express, Node.Js Tagged with: ,

Callbacks ?

Tweet What is Callbacks : You pass a function reference as a parameter to another function so that it can be executed at a later time function f1(a){ } function f2(b){ var a=10; b(a); } f2 (f1); Here i am

Posted in Javascript, Node.Js Tagged with: ,

Domain Module

Tweet A Node module called domain was introduced in Node 0.8.0 for handling errors. A domain module is like a flexible error handler for any and all errors that might be thrown within it. Using domains is the recommended method

Posted in Node.Js Tagged with:

Try-Catch to catch uncaught errors

Tweet The first thing that comes to the mind about handling uncaught errors is to use the try-catch on operations that are likely to throw a data error. process.nextTick(function() { try { get_data(); } catch(err) { console.log(err); res.send(500, 'Oops!'); }

Posted in Express, Node.Js Tagged with: ,

Error Handling in Node js

Tweet Error handling is a pain, and it’s easy to get by for a long time in Node.js without dealing with many errors correctly. But building robust Node.js(Node js) apps requires dealing properly with errors, and it’s not hard to

Posted in Express, Node.Js Tagged with: ,

Template engine Jade

Tweet Templates allow you to split your presentation information out from your program code,making it easier to arrange your project files and render out web pages with complicated structure. I am using jade template for this. To install the Jade

Posted in Express, Node.Js Tagged with: ,

Express Application

Tweet A simple and small practical server built using Express. To begin, the variable app is initialized by calling the express() function from the express library. The require command instructs Node to import the library express and assign it to

Posted in Express, Node.Js Tagged with: ,

Constructor Function 2 ?

Tweet How Does That Work? Here’s what happens when a function is called with the “new” keyword :- A call to “new Foo()” creates a new object instance, said to be of type “Foo”.The object instance is assigned a prototype

Posted in Javascript Tagged with:

Constructor Function ?

Tweet A Constructor Function : Consider the following function and call to the function: function Foo(){ this.bar = "baz"; console.log(this); } var f = new Foo(); console.log(f.bar); In this example, the “Foo” function is being used as a constructor function

Posted in Javascript Tagged with: