Blog Archives

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

Express JS to Deliver HTML Files (1)

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

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

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