I finally figured this out. Thanks for the help. I ended up doing this:
const fs = require('fs');
const request = require('request');
function beforeRender(req, res, done) {
console.log('hello');
request({
url: "https://pharmacyinformatics.local:3000/v1/inpatient/facilitiesNA",
method: "GET",
json: true,
strictSSL: false,
headers: {
'User-Agent': 'Super Agent/0.0.1',
'content-type': 'application/json'
},
}, function(err, response, body) {
//console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity'));
console.log('the error is: ', err);
//console.log('the response is: ', response);
//console.log('the decoded data is: ', body);
req.data = {
"facilities": body
};
console.log('here', req.data);
done();
}).on('data', function(data) {
// decompressed data as it is received
console.log('decoded chunk: ' + data);
}).on('response', function(response) {
// unmodified http.IncomingMessage object
response.on('data', function(data) {
// compressed data as it is received
console.log('received ' + data.length + ' bytes of compressed data');
})
})
}
Looks like I can move forward with a more robust test. If successful, my people will be in touch for acquiring a license.