title: POST with Fetch API to localhost:3000
body: <p><a href="https://i.stack.imgur.com/IxK1J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IxK1J.png" alt="Your name here"></a></p>
  
  <p>[JavaScript Vanilla] With these divs (that's not a form) I'm obtaining player's name. Now I want to POST it on my localhost, which works with JSON-Server, and I wrote that:</p>
  
  <pre><code>fetch('http://localhost:3000/db', { //OR 'http://localhost:3000/db' -same result
      method: 'POST',
      headers: {
          "Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
          //"Content-type": "application/json; raw"
      },
      body: "Name = " + document.getElementById("name").value
  })
      .then(function (data) {
          console.log('Request succeeded with JSON response', data);
      })
      .catch(function (error) {
          console.log('Request failed', error);
      });
  </code></pre>
  
  <p>But after that I get this error. </p>
  
  <p><a href="https://i.stack.imgur.com/NGwm0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NGwm0.png" alt="Error"></a></p>
  
  <p>I already have a 'db.json' file created in which I have an object.</p>