title: NestJS - How to access post body using @Body() decorator?
body: <pre><code>import { Controller, Post, Body } from '@nestjs/common';
  import { MyService } from 'my.service';
  import { MyDto } from './dto/my.dto';
  
  @Controller('my-route')
  export class MyController {
  
      constructor(private readonly _myService: MyService) {}
  
      @Post()
      async  myMethod(@Body() myDto: MyDto) {
          console.log(myDto); // undefined
          return await this._myService.doStuff(myDto.elementOfInterest); // Passes undefined variable into method.
      }
  }
  </code></pre>
  
  <p>I'm confused about the proper way to access the body form data from a POST in Nest. The documentation and examples all show simple use of the <code>@Body()</code> decorator preceding the name of a parameter which will contain the body (or a specific element in the body if a parameter is used). Yet in my example above, the body is never populated, and the method is called with <code>myDto</code> being undefined. Even changing its type to a string and simply passing a single key/value pair in the body of my POST leaves it undefined. </p>
  
  <p>What's the correct way to handle POST bodies in Nest?</p>