title: How to read ctx.request.body in koa 2 (without body-parser)?
body: <p>I want to read <code>ctx.request.body</code> from a post without body-parser middleware.</p>
  
  <pre><code>const Koa = require('koa');
  const Router = require('koa-router');
  const app = new Koa();
  const router = new Router();
  app.use(router.routes());
  
  router.post('/publish', async (ctx, next) =&gt; {
    let msg = JSON.stringify(ctx.request.body);
    console.log(msg); //undefined
    console.log(ctx.request.body); //undefined
    console.log(ctx.req.body);  //undefined
  });
  
  app.listen(process.env.PORT);
  </code></pre>
  
  <p>Using <code>curl -X POST -H "Content-Type: application/json" -d '{"key":"val"}' 'http://localhost:8080/publish'</code> I get 3 undefined.</p>
  
  <p>How do I solve this problem? I know that koa can't parse <code>req.body</code>, but why doesn't <code>JSON.stringify(ctx.request.body)</code> work?</p>