Permalink
Browse files

Updated router template to friendlier syntax

  • Loading branch information...
1 parent 5470cc9 commit c7e8f718da52835217bdd97d2daf4acca4f87682 @kieran committed Sep 5, 2012
Showing with 15 additions and 11 deletions.
  1. +15 −11 templates/base/router.js
View
@@ -17,20 +17,24 @@
*/
-var router = new geddy.RegExpRouter();
-router.match('/').to({controller: 'Main', action: 'index'});
+var router = exports.router = new geddy.RegExpRouter();
+
+router.get('/').to('Main.index');
// Basic routes
-// router.match('/moving/pictures/:id').to(
-// {controller: 'Moving', action: 'pictures'});
-// router.match('/farewells/:farewelltype/kings/:kingid').to(
-// {controller: 'Farewells', action: 'kings'});
+// router.match('/moving/pictures/:id', 'GET').to('Moving.pictures');
+//
+// router.match('/farewells/:farewelltype/kings/:kingid', 'GET').to('Farewells.kings');
+//
// Can also match specific HTTP methods only
-// router.match('/xandadu', 'get').to(
-// {controller: 'Xandadu', action: 'specialHandler'});
+// router.get('/xandadu').to('Xanadu.specialHandler');
+// router.del('/xandadu/:id').to('Xanadu.killItWithFire');
//
// Resource-based routes
// router.resource('hemispheres');
-
-exports.router = router;
-
+//
+// Nested Resource-based routes
+// router.resource('hemispheres', function(){
+// this.resource('countries');
+// this.get('/print(.:format)').to('Hemispheres.print');
+// });

0 comments on commit c7e8f71

Please sign in to comment.