mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-13 21:06:16 +08:00
Added get(), post(), put(), and del() utility functions for Resource
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user