node express async code example
Example: expressjs async await
app.post('/signup', async(req, res) => {
try {
const { email, firstName } = req.body
const user = new User({ email, firstName })
const ret = await user.save()
res.json(ret)
} catch (error) {
console.log(error)
}
})