A bit messy and incorrect code in the examples, but you can glean some good take-aways by comparing the pure Promise versions with async/await ones. These take-aways are key I think:
... As it is pretty clearly intended to be used for imperative code styles.
[...]
Rewriting callback-based Node.js applications
If you liked the good old concepts of if-else conditionals and for/while loops,
if you believe that a try-catch block is the way errors are meant to be handled, you will have a great time rewriting your services using async/await.
I actually like the functional programming paradigm, which means no for-loops, no try-catch. Sometimes async/await can do things cleaner though... and mixing styles is a mess. Life is hard.
A bit messy and incorrect code in the examples, but you can glean some good take-aways by comparing the pure Promise versions with async/await ones. These take-aways are key I think:
I actually like the functional programming paradigm, which means no for-loops, no try-catch. Sometimes async/await can do things cleaner though... and mixing styles is a mess. Life is hard.