Skip to content

Instantly share code, notes, and snippets.

@marcello3d
Created March 6, 2011 03:01
Show Gist options
  • Save marcello3d/856985 to your computer and use it in GitHub Desktop.
Save marcello3d/856985 to your computer and use it in GitHub Desktop.
function addRoute(app, path, controllerName) {
var controller = require("./controllers/" + (controllerName || path) )
['get','post','put','delete','all'].forEach(function (method) {
if (controller[method]) {
app[method](path, controller[method])
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment