I have a file called admin.js, which has a function that performs the action of returning a BOOLEAN based on if the ROLE column in the table is set to ADMIN. the problem is, I am trying to get a hold of this boolean in another function.
admin.js function
  const adminCheck = async (req, res, callback) => {
    console.log(“one”)
    await UtilRole.roleCheck(req, res, ‘ADMIN’, (response) =>  {
        if(response) {
            console.log(“one: true”)
             return true
         } else {
            console.log(“one: false”)
            return false
            //  return callback(null, false)
         }
     })
    }
    module.exports = {
    adminCheck
    }
in this above function, it is returning true or false depending on what the user is, but im not sure how to get that value into the index.js function, which is below:
then in my index.js, I have this:
 router.get(‘/viewRegistration’, auth.ensureAuthenticated, function(req, res, next) {
      const user = JSON.parse(req.session.passport.user)
      var query =  “SELECT * FROM tkwdottawa WHERE email = ‘” + user.emailAddress + “’”;
        console.log(“EMAIL ADDRESS user.emailAddress: ” + user.emailAddress)
        ibmdb.open(DBCredentials.getDBCredentials(), function (err, conn) {
          if (err) return res.send(‘sorry, were unable to establish a connection to the database. Please try again later.’);
          conn.query(query, function (err, rows) {
            if (err) {
            Response.writeHead(404);
          }
           res.render(‘viewRegistration’,{page_title:“viewRegistration”,data:rows, user});
          return conn.close(function () {
            console.log(‘closed /viewRegistration’);
          });
          });
        });
      //res.render(‘viewRegistration’, { title: ‘Express’, user });
    })
now my question is, how would I call the returned result of either true, or false, in my /viewregistration function in index.js?
 
    