2

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?

Rob
  • 9,664
  • 3
  • 41
  • 43
user2674150
  • 57
  • 1
  • 10

1 Answers1

3

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.

Naor Levi
  • 1,713
  • 1
  • 13
  • 27