title: Can't display request.body in server log?
body: <p>I'm new to Node and I can't seem to get my request to complete. I'm just trying to create a basic handshake between server and client by sending the location for the client to the server and displaying that into the server log. I'm not sure why I can't display the data into the log.</p>
  
  <p>Index.js</p>
  
  <pre><code>const express = require('express');
  const app = express();
  app.listen(8080, () =&gt; console.log('listening at 8080'));
  app.use(express.static('public'));
  app.use(express.json({limit: '1mb'}));
  
  app.post('/api',(request,response) =&gt; {
      console.log('I got a request!');
  console.log(request.body);
  });
  </code></pre>
  
  <p>Index.html</p>
  
  <pre><code> &lt;script&gt;
          if('geolocation' in navigator) {
              console.log('geolocation is avaliable');
              navigator.geolocation.getCurrentPosition(async position =&gt; {
                  const lat = position.coords.latitude;
                  const lon = position.coords.longitude;
  
                  console.log(lat,lon);
                  document.getElementById('latitude').textContent = lat;
                  document.getElementById('longitude').textContent = lon;
  
                  const data = {lat, lon};
                  const options = {
                      method: 'POST',
                      header:{
                          'Content-Type':'application/json'
                      },
                      body: JSON.stringify(data)
                  };
                  fetch('/api',options);
              });
          } else{
              console.log('geolocation is not avaliable');
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>Some things to note. The request does seem to complete and no errors are shown in the developer console.</p>
  
  <p>Server information:
  -[nodemon] restarting due to changes...</p>
  
  <p>-[nodemon] starting node index.js</p>
  
  <p>-listening at 8080</p>
  
  <p>-I got a request!</p>
  
  <p>-{}</p>