Here is the code
app.get('/home' , async(req, res) => {
let totalEmployees = Employee.find();
totalEmployees.count(function (err,totalWorkers) {
let total = totalWorkers
})
res.render('pages/home' , {total})
})
It does not allow me to use ejs to display the total variable as its undefined cause its out of the scope and exists only in the function , how do i make it accessible outside the scope