0
I have the following module getToken.js:
var rp = require('request-promise');
const options = {
url: 'https://meuservidor:8080/nifi-api/access/token',
method: 'POST',
gzip: true,
rejectUnauthorized: false,
headers: {
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
},
body: 'username=meuusuario&password=minhasenha'
}
rp(options)
.then(function(body) {
console.log(body)
})
.catch(function(err) {
console.log(err)
})
How to export content from console.log(body) to another module?
You just need to call
rp()once and you want to export the value ofbodyor you want to callrpof other modules and receivebodys different?– Sergio
I only need to call Rp() once and I want to export the body value
– Patrik Roger