title: How do I get request body in phoenix?
body: <p>I'm trying to build a phoenix application, and I handle a POST request. I want to get the request body, and I can't seem to find any documentation on how to do it.</p>
  
  <p>Doing some reverse engineering I got to the following code:</p>
  
  <pre><code>defmodule MyApp.Controllers.Pages do
    use Phoenix.Controller
  
    def post(conn) do
      {_, {_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, body, _, _, _, _, _, _}} = conn.adapter
      text conn, "#{inspect body}"
    end
  end
  </code></pre>
  
  <p>with routing:</p>
  
  <pre><code>defmodule MyApp.Router do
    use Phoenix.Router
  
    post "/test", MyApp.Controllers.Pages, :post
  end
  </code></pre>
  
  <p>There must be a better way, no?</p>
  
  <p>Expected behavior:</p>
  
  <pre><code>curl -XPOST localhost:4000/test -d 'this is a test'
  $ "this is a test"
  </code></pre>