Koa2 request.body is empty
<p>--- This question is pretty old and libraries used here are most likely outdated, the solution is still correct, but please use up-to-date versons ---</p>
<p>I am working on a web service with koa2 and node6. My koa dependencies as follows;</p>
<pre><code>&quot;koa&quot;: &quot;^2.0.0-alpha.4&quot;,
&quot;koa-async-body&quot;: &quot;^1.0.4&quot;,
&quot;koa-bodyparser&quot;: &quot;^3.2.0&quot;,
&quot;koa-logger&quot;: &quot;^1.3.0&quot;,
&quot;koa-router&quot;: &quot;^7.0.1&quot;,
</code></pre>
<p>My implementation is like this;</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>const apiPrefix = 'api',
      apiParent = 'auth',
      api = 'register',
      router = new Router();

router.prefix(`/${apiPrefix}/${apiParent}/${api}`);

router.post('/', async(context, next) =&gt; {
  try {
    console.log(context.request.body);
    context.body = await post(context.request.body);
    await next();
  } catch (err) {
    context.throw(500);
  }
});</code></pre>
</div>
</div>
</p>
<p>In another class, I bind this route to app. Also I have added bodyParser to the Koa as follows;</p>
<pre><code>const app = new Koa();

app.use(bodyParser());
</code></pre>
<p>When I try to log the request body, it's an empty object. On the other hand, this setup works fine with other people in this project.</p>
<p>What am I doing wrong? Am I using an outdated dependency?</p>