Created
June 28, 2017 18:47
-
-
Save sht5/52390c50af9a0833c0fc72910223aa19 to your computer and use it in GitHub Desktop.
example of ExpressJS endpoint logging an http error
This file contains 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
app.post('/user/defaultLanguage', (req, res) => { | |
const defaultLanguage = req.body.defaultLanguage; | |
const userEmail = req.user.email; | |
userLogic.updateUserDefaultLang(userEmail, defaultLanguage) | |
.then(() => { | |
res.end(); | |
}) | |
.catch((err) => { | |
utils.logHttpRequestError(res.req, err); | |
res.status(500).end(); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment