Created
May 11, 2010 06:56
-
-
Save dandean/396991 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Router = require('geddy-core/lib/router').Router; | |
| router = new Router(); | |
| router.match('/').to({controller: 'Main', action: 'index'}); | |
| router.resource('stuffs'); | |
| exports.router = router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Stuffs = function () { | |
| this.respondsWith = ['html', 'text', 'json']; | |
| this.index = function (params) { | |
| this.respond({params: params}); | |
| }; | |
| this.add = function (params) { | |
| this.respond({params: params}); | |
| }; | |
| this.create = function (params) { | |
| // Save the resource, then display index page | |
| this.redirect({controller: this.name}); | |
| }; | |
| this.show = function (params) { | |
| this.respond({params: params}); | |
| }; | |
| this.edit = function (params) { | |
| this.respond({params: params}); | |
| }; | |
| this.update = function (params) { | |
| // Save the resource, then display the item page | |
| this.redirect({controller: this.name, id: params.id}); | |
| }; | |
| this.remove = function (params) { | |
| this.respond({params: params}); | |
| }; | |
| }; | |
| exports.Stuffs = Stuffs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment