Skip to content

Instantly share code, notes, and snippets.

@dandean
Created May 11, 2010 06:56
Show Gist options
  • Select an option

  • Save dandean/396991 to your computer and use it in GitHub Desktop.

Select an option

Save dandean/396991 to your computer and use it in GitHub Desktop.
var Router = require('geddy-core/lib/router').Router;
router = new Router();
router.match('/').to({controller: 'Main', action: 'index'});
router.resource('stuffs');
exports.router = router;
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