NodeJS/Express: PUT and body parser, body object empty
<p>I write a simple rest api for a blog. I have the following code (main file): </p>

<pre><code>var port = process.env.PORT || 8080; 
var express = require('express'); 
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var database = require('./config/database');
var app = express(); 
mongoose.connect(database.url);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true})); 
app.use(express.static('public'));

mongoose.connection.once('open', function () {
    console.log('database connection established');
});

// Routes
app.use('/api/blog', require('./routes/blogroutes.js').router); 

// Start
app.listen(port, function () {
    console.log('listening on port ', port); 
}); 
</code></pre>

<p>The file <code>blogroutes.js</code> looks like the following (extract): </p>

<pre><code>var express = require('express');
var router = express.Router(); 

var BlogEntry = require('../models/blogEntry');

router.use(function (req, res, next) {
    next();
});

router.route('/entry/:year/:month/:day/:nr')
    //.get(...).delete(...)
    .put(function (req, res) {
        console.log(req.body); 
    });

router.post('/entry', function (req, res) {
    console.log(req.body); 
}); 

module.exports = {router: router}; 
</code></pre>

<p>The problem now is the following: When I call in the PowerShell <code>curl -uri http://localhost:8080/api/blog/entry/2016/3/2/3 -method put -body @{title='my first entry';text='Lorem ipsum'}</code>, the console output is <code>{}</code>. When I call in the PowerShell <code>curl -uri http://localhost:8080/api/blog/entry -method post -body @{title='my first entry';text='Lorem ipsum'}</code>, the console output is as expected <code>{ text: 'Wonderful', title: 'My second bike trip' }</code>. Do you have any idea why and how can I access the put body? </p>