Skip to content

Instantly share code, notes, and snippets.

@Abazhenov
Last active April 23, 2017 17:23
Show Gist options
  • Save Abazhenov/5fde0bb719610f526ac5aa5dda5c3f8c to your computer and use it in GitHub Desktop.
Save Abazhenov/5fde0bb719610f526ac5aa5dda5c3f8c to your computer and use it in GitHub Desktop.
router.get('/user/:id', async (req, res, next) => {
try {
const user = await getUserFromDb({ id: req.params.id })
res.json(user);
} catch (e) {
//this will eventually be handled by your error handling middleware
next(e)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment