Where is the object that references the @body payload stored?
If your user controller has a post function.
@Post() @HttpCode(HttpStatus.CREATED) create(@Body() user: IUserBase): Promise { return this.usersService.create(user); }
Where is the user variable stored? Is it stored in the request object of the nest.js server?
It is injected into the function as an argument.
The @body
decorator basically says:
Please cast the json that arrives in the request body into IUserBase
type and place it as a parameter to this controller's handler.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.