Please let me know how to read request data in node.js server .
Solved! Go to Solution.
Reading request payload in Apigee Edge is no different from reading the payload in a regular node.js application. Here is an example of reading payload info.
AFAIK , you need express/apigee-acces or such modules if we need to get the payload directly but if we want to use node.js to parse the req the only way is as below.
//https://nodejs.org/api/http.html#http_http_createserver_requestlistener
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.test); }) resp.end('Hello, World!'); });
The problem that pani has is, he is on a release which supports node.js but not apigee-access-module.
@sudheendra1 , @sarthak , Am I missing anything or do you see any issues with the above code to parse request body ?