← Node.js & Express learning pathNode.js & Express · Module 3 of 10
Async JavaScript in Node
Handle files, timers and network calls with callbacks, promises and async/await.
📖 Key ideas
- Callbacks were the original async style (error-first: (err, data)).
- Promises represent a future value.
- async/await makes async code read like normal code.
- Wrap await in try/catch to handle errors.
- Promise.all runs tasks in parallel.
💡 Real-life example: async/await is ordering food with a buzzer: you sit down and are called when it is ready.
CallbackFunction called when work finishes
PromiseObject for a future result
awaitPauses until a promise settles
Promise.allWaits for several promises together