I have a test JSON object as follows
{ Id: 100, plugins: [{ Name: 'Test', Version: '2' }] }
which I created using
var json = {};
json.Id = 100;
var plugins = [];
json.plugins = plugins;
json.plugins.push({"Name" : "Test", "Version" : "2"});
I have a client side function making an AJAX post request as follows
function postJSON() {
$.ajax({
type: 'POST',
url: 'features',
data: json,
dataType: 'json'
});
}
I am trying to read this information on my server by just typing console.log(req) for now but it does't seem to be getting my json object.
app.post("/features", function(req, res) {
console.log(req);
})
Thanks for help!
var json = { Id: 100, plugins: [{ Name: 'Test', Version: '2' }] }