Added get(), post(), put(), and del() utility functions for Resource

This commit is contained in:
DallonF
2012-11-20 11:51:36 -07:00
parent 144927c5ea
commit 8fc463229f

View File

@@ -159,7 +159,39 @@ Resource.prototype.load = function (fn) {
*/
Resource.prototype.handle = function (ctx, next) {
ctx.end();
switch (ctx.method) {
case 'GET':
this.get(ctx, next);
break;
case 'POST':
this.post(ctx, next);
break;
case 'PUT':
this.put(ctx, next);
break;
case 'DELETE':
this.del(ctx, next);
break;
default:
next();
break;
}
};
Resource.prototype.get = function(ctx, next) {
next();
};
Resource.prototype.post = function(ctx, next) {
next();
};
Resource.prototype.put = function(ctx, next) {
next();
};
Resource.prototype.del = function(ctx, next) {
next();
};
/**