google_groups-nodebr-rZ4RD0QbqNU
module.exports = function (object, callback) {
// Save no DB
callback();
}
const gravar = require('./gravar.js');
function getBoleto () {
return axios.get(
'/boletos',
).then(res => {
return res.data;
})
.catch(err => {
console.log('Erro ao obter os boletos', err);
})
}
getBoleto().then(boletos => {
gravar(boletos, function(err) {
if (err) {
throw new Error('Boletos são salvos');
}
console.log('Boletos salvos.');
});
});