tspace-spear
Version:
tspace-spear is a lightweight API framework for Node.js that is fast and highly focused on providing the best developer experience. It utilizes the native HTTP server
25 lines • 922 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0;
const methodDecorator = (method) => {
return (path) => {
return (target, propertyKey) => {
const controller = target.constructor;
const routers = Reflect.hasMetadata("routers", controller)
? Reflect.getMetadata("routers", controller)
: [];
routers.push({
method,
path,
handler: propertyKey,
});
Reflect.defineMetadata("routers", routers, controller);
};
};
};
exports.Get = methodDecorator('get');
exports.Post = methodDecorator('post');
exports.Put = methodDecorator('put');
exports.Patch = methodDecorator('patch');
exports.Delete = methodDecorator('delete');
//# sourceMappingURL=methods.js.map