4 ms·
Promises made some very valuable improvements to code patterns relative to callback-based implementations, but as a broader "nodejs vs synchronous style code" i
by qooleot 9y ago
Promises made some very valuable improvements to code patterns relative to callback-based implementations, but as a broader "nodejs vs synchronous style code" its still much harder. You sound pretty versed, but other folks might struggle. Here is an example explanation:
https://pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html https://pouchdb.com/2015/05/18/we-have-a-problem-with-promis...
If we're trying to show the simplicity of modern nodejs code with non-blocking I/O, I would suggest we lead with examples like:
const foo = await queryFooObject(id);
await writeToFile(foo);
True, there's still plenty of value in promises, especially for things like:
await Promise.all(severalParallelQueries);