Express + Postman, req.body is empty
AFAIK you need to use the Body-Parser : https://github.com/expressjs/body-parser
bodyParser = require('body-parser').json();app.post('/itemSearch', bodyParser, function(req, res) { //var Keywords = req.body.Keywords; console.log("Yoooooo"); console.log(req.headers); console.log(req.body); res.status(200).send("yay");});
Then try with PostMan setting the body as raw
json:
{ "test": "yay"}
Try this
// create application/json parser app.use(bodyParser.json()); // parse various different custom JSON types as JSON app.use(bodyParser.json({ type: 'application/*+json' })); // parse some custom thing into a Buffer app.use(bodyParser.raw({ type: 'application/vnd.custom-type' })); // parse an HTML body into a string app.use(bodyParser.text({ type: 'text/html' })); // parse an text body into a string app.use(bodyParser.text({ type: 'text/plain' })); // create application/x-www-form-urlencoded parser app.use(bodyParser.urlencoded({ extended: false }));