I have learning locker running locally in my computer and I would like to show the statements in an external website, this is easy with the dashboards as there is the option to have a link that can be put into an iframe, but when I do the same with the part of the statements it says that the ip (learning locker) has blocked the access, so I tried with the statement forwarding to a node.js server created as:
const http = require('http');
const { parse } = require('querystring');
const server = http.createServer((req, res) => {
if (req.method === 'POST')
{
console.log(req);
}
});
server.listen(8090);
But when I look at the req (Incomming Message) and it appears as empty, I has some fields as the headers:
headers:
{ accept: 'application/json, text/plain, */*',
'content-type': 'application/json',
'x-experience-api-version': '1.0.0',
'user-agent': 'axios/0.18.1',
'content-length': '532',
host: 'IP_ADDRESS:8090',
connection: 'close' },
rawHeaders:
[ 'Accept',
'application/json, text/plain, */*',
'Content-Type',
'application/json',
'X-Experience-API-Version',
'1.0.0',
'User-Agent',
'axios/0.18.1',
'Content-Length',
'532',
'Host',
'IP_ADDRESS:8090',
'Connection',
'close' ],
But there are no body and nothing related with the statement.
by default, nodejs server do not parse POST body. You can try using https://www.npmjs.com/package/body-parser middleware with express.js framework