Preparation
The Problem: Callback Hell
validateOrder(order, (err, validation) => {
if (err) return console.error(err);
calculateTotal(order, (err, total) => {
if (err) return console.error(err);
checkStock(order, (err, stock) => {
if (err) return console.error(err);
processPayment(order, total, (err, receipt) => {
if (err) return console.error(err);
// Finally done... but look at this pyramid!
});
});
});
});What is a Promise?
Consuming Promises: .then() and .catch()
Chaining Promises
Creating Promises
async/await: Even Cleaner Syntax
Error Handling with try/catch
Promise.all: Parallel Operations
Summary
Term
Meaning
Pre-Reading (Optional)
The Tea Shop API
Last updated