I am running this code but it give me this error. const hashedPassword = await bcrypt.hash(req.body.password, 10) SyntaxError: await is only valid in async functions and the top-level bodies of modules
app.post('/register', (req, res) => { //register/signup
try{
const hashedPassword = await bcrypt.hash(req.body.password, 10)
users.push({
id: Date.now().toString(),
name: req.body.name,
email:req.body,email,
password: hashedPassword
})
res,redirect('/login')
}catch{
res.redirect('/register')
}
console.log(users)
})`enter code here`