In my first file : pro.js
const newly = async function getBalance(account,address){
const resp = await fetch(
`https://api-link`,
{
method: 'GET',
headers: {
'api-key': ....
}
}
);
account = await resp.json();
return account;
}
module.exports = {
newly
}
second file : index.js
const myNewly = require('./pro');
app.post('/getBalance/type',jsonParser,function(req,res){
console.log(myNewly.newly(account,req.body.address)); // return Promise { <pending> }
res.send(myNewly.newly(account,req.body.address)); // return nothing in postman
})