Created
November 3, 2017 06:22
-
-
Save saiumesh535/91894a2be7163fe3b25f14cfacb7c57c to your computer and use it in GitHub Desktop.
mediumpost
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
async function check(req, res) { | |
someOtherFunction().then((a) => { | |
somethingElseFunction().then((b) => { | |
res.status(200).json({a: a, b: b}); | |
}).catch((error) => { | |
res.send("error"); | |
}) | |
}).catch((error) => { | |
res.send("error"); | |
}) | |
} | |
someOtherFunction = () => { | |
return new Promise((resolve, reject) => { | |
setTimeout(function () { | |
resolve("something") | |
}, 10); | |
}) | |
} | |
somethingElseFunction = () => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve("not a error"); | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment