'How to add Promise value in render() in node js

router.get('/top-website', function (req, res, next) {

// console.log(topSites) connection.query("SELECT * FROM topsites LIMIT 5", function (err, results, fields) {

  // const url =this.rootDomain;
  results.forEach(function (item) {
    console.log(item.rootDomain)
    linkPreview(item.rootDomain)
      .then(resp => {
        console.log(resp)
        res.render('top-website', { sitedata: results,fn:resp });
        
        
        //console.log(resp)
      })

  })

}) })

i want to get value resp in render but im getting error,enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source