@lattice/core
Version:
34 lines (33 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var __1 = require("..");
exports.METHOD_META_LIST = '__method_meta_list__';
function Method(method, uri) {
if (uri === void 0) { uri = ''; }
return function (target, targetKey) {
var metaList = Reflect.getMetadata(exports.METHOD_META_LIST, target.constructor) || [];
metaList.push({ uri: uri, type: method, payload: target[targetKey] });
Reflect.defineMetadata(exports.METHOD_META_LIST, metaList, target.constructor);
};
}
exports.Method = Method;
function Get(uri) {
if (uri === void 0) { uri = ''; }
return Method(__1.HttpMethod.GET, uri);
}
exports.Get = Get;
function Post(uri) {
if (uri === void 0) { uri = ''; }
return Method(__1.HttpMethod.POST, uri);
}
exports.Post = Post;
function Put(uri) {
if (uri === void 0) { uri = ''; }
return Method(__1.HttpMethod.PUT, uri);
}
exports.Put = Put;
function Delete(uri) {
if (uri === void 0) { uri = ''; }
return Method(__1.HttpMethod.DELETE, uri);
}
exports.Delete = Delete;