I'm currently exploring Express and asynchronous/functional programming.
app.get('/users/:id', (req, res) => {
let id = req.params.id;
let User = require('../models/user')
User.is_complete(id, (validate) => {
console.log(validate)
})
User.find(id, (user) => {
console.log(user)
res.render('users/index', {user: user, validate: validate})
})
})
I want to display the view with two variables: the validation result of User.is_complete and the user object from User.find
Can anyone guide me on how to achieve this?
Appreciate your help!