At first glance -- async/await mitigates a lot of my least favorite things about orm dsl's -- namely that it can be difficult to tell when the orm framework is actually going to generate a db round trip without being familiar with the implementation ... thinking back to the most recent orm i had to learn (rails) and how it was quite annoying to get started with while interacting with an existing codebase. clear suspe…
This doesn’t always work with Node APIs, one example that comes to mind is fetch (for making URL requests). When you await a fetch(url) you get a response object, where a bunch of functions on it (like json() IIRC) are themselves promises - but not making another API call. I’m not actually sure why it’s structured like that, I guess to give unified error handling/callback syntax between the call failed and the unexpe…
1. Parse the data as json
2. Return it without parsing
3. Modify some other part of the response but never parse the body
4. Turn around and stream that body into another fetch without parsing it.
Etc. parsing it and loading a large response into memory may not always be desirable so it must be explicitly done with await res.body.json().