Created
January 21, 2022 08:22
-
-
Save adityawibisana/5bdba0143acada8015b6c6cb0e387c7b to your computer and use it in GitHub Desktop.
Medium Sails UserController after error handling to UserService:
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
module.exports = { | |
register: (req, res) => { | |
const error = UserService.handleError(req) | |
if (error) { | |
return res.status(400).send(error) | |
} | |
... continue processing registration | |
}, | |
login: (req, res) => { | |
const error = UserService.handleError(req) | |
if (error) { | |
return res.status(400).send(error) | |
} | |
... continue processing login | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment