title: node.js & express: req.body undefined
body: <p>I'm currently designing a simple browser application utilizing express. I'm trying to extract the value a user selects in a drop down menu. I gave each option an individual value as well and have declared the method of the form as /post.  but when I try which value they selected by going into the <code>req.body</code>, the value is undefined. </p>
  
  <p>I recognize that the problem could lie with the body parser from browsing through similar questions (<a href="https://stackoverflow.com/questions/27320191/express4-10-bodyparser-req-body-undefined">Example</a>, <a href="https://stackoverflow.com/questions/27237744/node-js-express-html-form-req-body-is-undefined">Example1</a>) but the solutions from these questions don't keep <code>req.body</code> from being undefined. </p>
  
  <p>Here's my code for the app construction</p>
  
  <pre><code>const app = express()
  app.use(express.static(__dirname, ''));
  app.engine('html', require('ejs').renderFile);
  app.set('views', __dirname + '/public/views');
  app.use(express.urlencoded());
  app.set('view engine', 'html');
  const server = http.createServer(app);
  </code></pre>
  
  <p>And here's the code for the post handling </p>
  
  <pre><code>app.get('/detailed', function(req,res){
      res.send(displayDetailed(results, req));
  });
  app.post('/detailed', function(req,res){
      res.send('Hello world');
      console.log(req.body);
  
  });
  </code></pre>
  
  <p>When I post something in localhost:8080/detailed, the hello world returns just fine, but req.body is an empty (returns as {}).
  The displayDetailed function is a custom function that returns a html string with values extracted from a get request from the google sheets API. Since I'm not working with a saved html document, could this be affecting the process? </p>