About Me

My photo
जिंदगी की परीक्षा में कोई नम्बर नहीं मिलते है लोग आपको दिल से याद करे तो समझ लेना आप पास हो गए....

Saturday 25 January 2014

Notes on Express JS

Express JS is a web application framework used to develop nodejs application easily.

As Express builds over Connect middleware, it brings in a lot of existing
functionality from Connect. Connect's use method configures the app to utilize
the given middleware handle for the given route, where the route defaults to /. You can see the list of middleware provided by Connect at http://www.senchalabs.org/connect/.

app.use(express.methodOverride());

Method Override enables the faux HTTP method support. This means that if we
would like to stimulate the DELETE and PUT method calls to our application, we can do it by adding a _method parameter to the request.

app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));


app.router provides an enhanced version of Connect's router module. Basically,
this is the component that determines what to do when we use routing methods like app.get. The last middleware, Static, provides a static file server and configures it,serving files from the public directory.


Reference : Socket.IO Real-time Web Application Development

No comments:

Post a Comment