Created
November 18, 2015 11:15
-
-
Save muhammadghazali/e033a744ab712758040c to your computer and use it in GitHub Desktop.
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
Something | |
.findOne({ | |
where: { | |
id: somethingId | |
} | |
}) | |
.then(function(something) { | |
if (!something) { | |
res.notFound('Something is not found.'); | |
return; | |
} | |
return doSomethingCool(); | |
}) | |
.then(function(resultOfSomethingCool) { | |
return res.ok(resultOfSomethingCool); | |
}) | |
.catch(function(err) { | |
return res.serverError(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment