title: body-parser, Unexpected token u in JSON at position
body: <p>I am using body-parser to get at the body of a POST request. My <code>index.js</code> file looks like this:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var bodyParser  = require('body-parser');
  
  app.use(bodyParser.urlencoded({
    extended: true
  }));
  app.use(bodyParser.json());
  app.use(express.json());
  
  app.post('/', function(request, response){
      console.log(request.body);
      res.send("test");
  });
  
  app.get('/', function(req, res) {
    res.send('Hello World!');
  });
  
  
  
  app.listen(8080, function() {
    console.log('Example app listening on port 8080!');
  });
  </code></pre>
  
  <p>When I boot up my docker, I get the listening message as expected.</p>
  
  <p>When I run the command:</p>
  
  <pre><code>curl -d {"user":"Someone"} -H "Content-Type: application/json" --url http://localhost:8080
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Unexpected token u in JSON at position 1
  at JSON.parse (&lt;anonymous&gt;)
  </code></pre>
  
  <p>I'm confused because I don't directly call json.parse anywhere</p>