I am getting http post message, but can't get the body outside the getRawBody function.
Here is my code:
getRawBody(req, function(err, body) {
    for (var key in req.queries) {
     var value = req.queries[key];
      resp.setHeader(key, value);
    }
    string = params.body = body.toString();
    string=querystring.parse(string);
    data=string.data;
    object=JSON.parse(data);
    console.log(object)     
    resp.send(JSON.stringify(object, null, '    '));
});
console.log(object);
The first console log outputs the correct JSON like
{ id: 'ddeklj' }.
But the second console log outputs is undefined.
My question is: How can I get the variables object from the function?
 
     
     
    