When we send a post request to node.js how to read the data from the payload. Apigee-access module is not supporting in our environment is there any other way to read the data from the payload.
Solved! Go to Solution.
This needs to be handled using express. Please refer to generic node.js POST data handling logic,
For example: http://stackoverflow.com/questions/4295782/how-do-you-extract-post-data-in-node-js
Wondering what is the issue with apigee-access module ?
@Kodandapani, As @Madhan Sadasivam mentioned you can try express but as apigee-access module is not supported on the Edge release you are or you can try the below on your node.js script itself and see if it helps you
@Madhan Sadasivam, do you see any issues with running the below code on edge ? I tried and it works fine .
var svr = http.createServer(function(req, resp) { var body = ""; req.on('data', function (chunk) { body += chunk; }); req.on('end', function () { console.log('body: ' + body); var jsonObj = JSON.parse(body); console.log(jsonObj.$key); }) resp.end('Hello, World!'); });
This needs to be handled using express. Please refer to generic node.js POST data handling logic,
For example: http://stackoverflow.com/questions/4295782/how-do-you-extract-post-data-in-node-js
Wondering what is the issue with apigee-access module ?
@Kodandapani, As @Madhan Sadasivam mentioned you can try express but as apigee-access module is not supported on the Edge release you are or you can try the below on your node.js script itself and see if it helps you
@Madhan Sadasivam, do you see any issues with running the below code on edge ? I tried and it works fine .
var svr = http.createServer(function(req, resp) { var body = ""; req.on('data', function (chunk) { body += chunk; }); req.on('end', function () { console.log('body: ' + body); var jsonObj = JSON.parse(body); console.log(jsonObj.$key); }) resp.end('Hello, World!'); });
I think this is a duplicate of thread , which is already answered --> http://community.apigee.com/questions/2870/how-to-read-request-payload-in-nodejs.html
Thanks, We are able to read the request payload in node.js
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |