Skip to content

Instantly share code, notes, and snippets.

@muhammadghazali
Created November 18, 2015 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muhammadghazali/e033a744ab712758040c to your computer and use it in GitHub Desktop.
Save muhammadghazali/e033a744ab712758040c to your computer and use it in GitHub Desktop.
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