Saturday, 10 March 2012

node.js boilerplate - seperate routes into modules and export

This is a great way to improve the readability of your node application; move all routes into separate modules and export.

Put the following in a file called home.js:



Put the following in a file called login.js:



Add both to a folder called routes.

From your application file:



References
github.com/visionmedia/express/tree/master/examples/route-separation

About
This post is part of a series of posts tagged under node-plates a boilerplate mobile/web application written in node.js, express, socket.io, mongooose, jquery.mobile & html 5.

Github
You can grab this from github ->
https://github.com/AndrewKeig/node-plates

No comments:

Post a Comment