Skip to content

Instantly share code, notes, and snippets.

@adityawibisana
Created January 21, 2022 08:22
Show Gist options
  • Save adityawibisana/5bdba0143acada8015b6c6cb0e387c7b to your computer and use it in GitHub Desktop.
Save adityawibisana/5bdba0143acada8015b6c6cb0e387c7b to your computer and use it in GitHub Desktop.
Medium Sails UserController after error handling to UserService:
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