Hello, how can I use the same script to bring different information to fill in each excel sheet?
function beforeRender(req, res, done) {
req.options = req.options || {}
req.options.preview = false
require('request')({
url:"http://XX.XXX.XXX.XXX:8080/lib/jsonpa.php?tp=cartera1",
json:true
}, function(err, response, body){
console.log(JSON.stringify(body))
req.data = Object.assign({}, req.data, { cartera1: body })
done();
});
require('request')({
url:"http://XX.XXX.XXX.XXX:8080/lib/jsonpa.php?tp=cartera2",
json:true
}, function(err, response, body){
console.log(JSON.stringify(body))
req.data = Object.assign({}, req.data, { cartera2: body })
done();
});
return;
}
o
function beforeRender(req, res, done) {
req.options = req.options || {}
req.options.preview = false
require('request')({
url:"http://XX.XXX.XXX.XXX:8080/lib/jsonpa.php?tp=cartera1",
json:true
}, function(err, response, body){
console.log(JSON.stringify(body))
req.data = Object.assign({}, req.data, { cartera1: body })
done();
});
return;
}
function beforeRender2(req, res, done) {
req.options = req.options || {}
req.options.preview = false
require('request')({
url:"http://XX.XXX.XXX.XXX:8080/lib/jsonpa.php?tp=cartera2",
json:true
}, function(err, response, body){
console.log(JSON.stringify(body))
req.data = Object.assign({}, req.data, { cartera2: body })
done();
});
return;
}