app.get('/', (req, res) => {
var listem = ['172.31.1.2', '122.31.2.3']
listem.forEach(element => {
var connection = MikroNode.getConnection(element, 'admin', "password..", {
closeOnDone: false
});
var connPromise = connection.getConnectPromise().then(function (conn) {
var chan1Promise = conn.getCommandPromise('/system/identity/print');
var chan2Promise = conn.getCommandPromise('/ip/pool/print');
Promise.all([chan1Promise, chan2Promise]).then(function resolved(values) {
var val = values[0]
var vals = values[1]
console.log('s');
res.removeHeader('s')
res.json({ val, vals })
conn.close();
}, function rejected(reason) {
console.log('Oops: ' + reason);
});
});
});
})
CANNOT REMOVE HEADERS AFTER THEY ARE SENT TO THE CL
How can I fix this. How can I export my codes in Promise. Please help me.enter image description here
Aucun commentaire:
Enregistrer un commentaire