title: Node.js req.body is empty when using POST method
body: <p>I'm really new to using REST and Express and I've been following this <a href="https://www.youtube.com/watch?v=eB9Fq9I5ocs" rel="nofollow noreferrer"> tutorial </a> on REST API. Here is my <strong>app.js</strong> code:</p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var mongoose = require("mongoose");
  
  var app = express();
  var port    = parseInt(process.env.PORT, 10) || 3000;
  
  app.use(bodyParser.urlencoded({ extended: true}));
  app.use(bodyParser.json());
  
  Genre = require('./models/genre');
  
  //Connect to mongoose
  mongoose.connect('mongodb://localhost/bookstore');
  
  var db = mongoose.connection;
  
  app.listen(port);
  console.log('Running on port 3000\n\n');
  
  app.post('/api/genres', function(req, res){
          console.log(req.body);
          var genre = req.body;
          Genre.addGenre(genre, function(err, genre){
              if (err) {
                  console.log(err);
                  res.send({status: 'something went wrong'});
              }else{
              res.send({status: 'saved'});
              res.json(genre);}
          });
  }); 
  </code></pre>
  
  <p>I'm using Rest Easy on Firefox to check the POST request. The error being generated is "Genre Validation failed" because the body is empty. The schema used for this is defined in the model as: </p>
  
  <pre><code>var mongoose = require("mongoose");
  
  //Genre Schema
  var genreSchema = new mongoose.Schema({
  
      name: {
          type: String,
          required: true
      },
      create_data:{
          type: Date,
          default: Date.now
      }
  });
  
  var Genre = module.exports = mongoose.model('Genre', genreSchema);
  
  // add genre
  module.exports.addGenre = function(genre, callback){
      Genre.create(genre, callback);
  };
  </code></pre>
  
  <p>I've tried several other popular threads but it still isn't solving the problem. I've tried rearranging the order of how modules are imported and input the data as form using 'application/x-www-form-urlencoded'. Any idea? </p>
  
  <p><strong>Edit</strong>: Output of console.log(req.body):</p>
  
  <pre><code>{}
  </code></pre>
  
  <p>Output of console.log(req) is at <strong>jbkb1yxa</strong> on jsfiddle.net.(StackOverflow wont let me embed more links since i have low reputation points,apologies.)
  Screenshot of REST easy:
  <a href="https://imgur.com/6QmQqRV" rel="nofollow noreferrer">http://imgur.com/6QmQqRV</a></p>