Tutorial by Examples

module.exports.routes = { 'GET /foo': 'FooController.index', 'GET /foo/new': 'FooController.new', 'POST /foo/create': 'FooController.create', 'GET /foo/:id/edit': 'FooController.edit', 'PUT /foo/:id/update': 'FooController.update', 'GET /foo/:id': 'FooController.show', ...
module.exports.routes = { '/foo': '/bar', 'GET /google': 'http://www.google.com' };
module.exports.routes = { // This function will be executed for all http verbs on all urls 'all /*', function (req, res, next) { // Expose the function `fooBar` to all views (via the locals object) res.locals.fooBar = function (arg1) { return 'foobar' + arg1; }; }, };...
module.exports.routes = { 'GET /foo/*': { fn: function(req, res) { res.send("FOO!"); }, skipAssets: true }, };
module.exports.routes = { // sends matching regex (few patterns) as 'page' param 'r|/foo/([0-9]+)|page': 'FooController.get', 'r|/foo/(.*)|page': 'FooController.get', 'r|/foo/(\\w+)|page': 'FooController.get' };
module.exports.routes = { 'GET /blog/:year/:month/:day/:posttitle/': 'BlogController.showPost', 'GET /blog/:year/:month/:day/': 'BlogController.showDayArchive', 'GET /blog/:year/:month/': 'BlogController.showMonthArchive', 'GET /blog/:year/': 'BlogController.showYearArchive', }; The ...

Page 1 of 1