routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
20 lines • 744 B
JavaScript
import { getMetadataArgsStorage } from '../index';
/**
* Injects a request's route parameter value to the controller action parameter.
* Must be applied on a controller action parameter.
*/
export function Param(name) {
return function (object, methodName, index) {
getMetadataArgsStorage().params.push({
type: 'param',
object: object,
method: methodName,
index: index,
name: name,
parse: false, // it does not make sense for Param to be parsed
required: true, // params are always required, because if they are missing router will not match the route
classTransform: undefined,
});
};
}
//# sourceMappingURL=Param.js.map