Last active
April 23, 2017 17:23
-
-
Save Abazhenov/5fde0bb719610f526ac5aa5dda5c3f8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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