Quoting from the Express.js's middleware documentation,
As of 4.x, Express no longer depends on Connect. All of Express' previously included middleware are now in separate repos. Please view the list of middleware. The only included middleware is now
express.static()
.
So, to use json
middleware, you need to include the body-parser
in the package.json
and then use like this
var bodyParser = require('body-parser');
app.use(bodyParser.json());