Nodejs 修复 [object Promise]

Nodejs fix [object Promise]

我想获取tron钱包的余额
当我想 return 它用 express js 在网页上显示它时它会打印 [object Promise]

var express = require('express');
var router = express.Router();
const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
        fullNode: 'https://api.trongrid.io',
        solidityNode: 'https://api.trongrid.io',
        eventServer: 'https://api.trongrid.io'
    }
)
/* GET home page. */
const userBalance = async function() {
  const getUserBalance = await tronWeb.trx.getBalance("TNBE5fs2tGTnaJhCvd1Qy2BQ1k2j7Yv5zs")
  const userBalance = getUserBalance;
   return userBalance;
};
router.get('/', function(req, res, next) {
  //userBalance();
  res.render('index', {
      title: 'Express',
      userBalance: userBalance(),
  });
});

module.exports = router;

你应该写

router.get('/', async function(req, res, next) {
  const userBalance = await userBalance();
  res.render('index', {
      title: 'Express',
      userBalance: userBalance
  });
});