Parsing JSON post requests in Node.js with Express 4 Parsing JSON post requests in Node.js with Express 4 express express

Parsing JSON post requests in Node.js with Express 4


It will work if you use setRequestHeader:

var req = new XMLHttpRequest();req.open('POST', 'http://localhost:8080/acceptContacts');req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");var obj = {hello:'world'};req.send(JSON.stringify(obj));