Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example for the "Callback Hell" with chained web requests
request("https://www.andreasjakl.com/wp-content/uploads/2018/08/arcore-anchors.gif", function(error, response, body) {
if (error) {
// Handle error
console.log("Error: ", error);
} else {
if (response && response.statusCode == 200) {
request("https://www.andreasjakl.com/wp-content/uploads/2018/08/SLAM-HoloLens-2000x1163.jpg", function(error, response, body) {
if (error) {
console.log("Error: ", error);
} else {
console.log("status code:" , response && response.statusCode);
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment