I want pass array in my route POST
I Did try this
my object is
var myobj = [{name:'foo',name:'bar',name:'buz'}]
and I want pass these values in this http.request
var options = {
hostname : 'myhost',
port : 'myport',
path : 'myroute',
method : 'POST',
agent : false,
body : myobj,
headers : {'Content-Length': myobj.length}
};
var req = http.request(options,function(res) {});
router.post('myroute', function( req, res ){
//I want myobj here
console.dir(req.body); //EMPTY
})
I did try also
path : 'myroute'+myobj and i recived socket hang up
I did try also
json = JSON.stringify(docs);
Content-Lengthis0?myobj.lengthis1. How do you expect the array to be serialized to a string?