routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
25 lines • 919 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Body = Body;
const index_1 = require("../index");
/**
* Allows to inject a request body value to the controller action parameter.
* Must be applied on a controller action parameter.
*/
function Body(options) {
return function (object, methodName, index) {
(0, index_1.getMetadataArgsStorage)().params.push({
type: 'body',
object: object,
method: methodName,
index: index,
parse: false,
required: options ? options.required : undefined,
classTransform: options ? options.transform : undefined,
validate: options ? options.validate : undefined,
explicitType: options ? options.type : undefined,
extraOptions: options ? options.options : undefined,
});
};
}
//# sourceMappingURL=Body.js.map
;