Blog Archives


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: ,

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: ,

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: ,

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: ,

What are Routes ?

Tweet Routes describes the interfaces for making requests to your web app. Combining an HTTP request method and a path, you define URLs in your app. Each route has an associated route handler, which does the job of performing any

Posted in Node.Js Tagged with:

Express Hello World

Tweet First Node js Express Hello world example: // Include the Express module Var express = require ('express'); // Create an instance of Express var app = express (); // A route for the home page app.get('/', function(req,res){ res.send('<h1>Hello</h1> Express');

Posted in Node.Js Tagged with: ,