title: Get the data of a PUT request NodeJS http
body: <p>I am trying to get the data of a PUT request from a http server. I've tried the following:</p>
  <pre class="lang-js prettyprint-override"><code>const http = require('http');
  
  const server = http.createServer(async (req, res) =&gt; {
      const body = await new Promise(resolve =&gt; {
         const data = [];
  
         req.on('data', chunk =&gt; {
             data.push(chunk);
         });
  
         req.on('end', () =&gt; {
             resolve(data.join(''));
         });
     });
  
     console.log(body);
  });
  
  server.listen(80);
  </code></pre>
  <p>But when I make a PUT request to this server with the <code>name</code> 'Test' and the <code>value</code> 'Test' I get the following response:</p>
  <pre><code>------WebKitFormBoundary5irMnjtb69WOI025
  Content-Disposition: form-data; name=&quot;Test&quot;
  
  Test
  ------WebKitFormBoundary5irMnjtb69WOI025--
  </code></pre>
  <p>How do I make a JSON object of this?</p>