Body
Route handler parameter decorator. Extracts the entire body
object
property, or optionally a named property of the body
object, from
the req
object and populates the decorated parameter with that value.
Also applies pipes to the bound body parameter.
@Body(property?: string | PipeTransform<any, any> | Type<PipeTransform<any, any>>, ...pipes: (PipeTransform<any, any> | Type<PipeTransform<any, any>>)[])
Parameters
Option | Type | Description |
---|---|---|
property
|
string | PipeTransform |
name of single property to extract from the
|
pipes
|
(PipeTransform |
one or more pipes - either instances or classes - to apply to the bound body parameter. |
Returns
ParameterDecorator
See also
Description
For example:
async create(@Body('role', new ValidationPipe()) role: string)