I have a server:
app.post('/', function(req, res, next) { console.log(req); res.json({ message: 'pppppppppppppssssssssssssss ' }); });
The request is sent from the client as:
$.ajax({ type: "POST", url: self.serverURI, data: JSON.stringify({ "a": "128", "b": "7" }), dataType: 'json', success: function (result) { console.log(result); }, error: function (xhr, ajaxOptions, thrownError) { console.log(xhr); } });
while the connection is perfect.
My problem on the server:
console.log(req);
where I want to read the data that I sent. How to read { "a": "128", "b": "7" }
from req
?
source share