Why is domain API deprecated in Node.js?
I found it handy to catch errors in context of a incoming web request rather than exception boiling up to the level of process.
Also, is there any alternative to domain APIs that can be now be used?
Why is domain API deprecated in Node.js?
I found it handy to catch errors in context of a incoming web request rather than exception boiling up to the level of process.
Also, is there any alternative to domain APIs that can be now be used?
Node.js issue #66: deprecate domains:
The problem isn't the user experience of domains, as you say the API is simple and users are generally happy with it, but the consequences domains have in maintenance and complications for the node.js core code – that seemingly simple API impacts all of the code base in a too negative way.
Domains in its current form must go. That's certain. What the alternative is, no one knows.
I don't get how we can deprecate something that covers a use case that cannot be covered otherwise, without providing clear (and ready) alternatives.
If we flip that the other way around. We know domains must go, and will have to be removed at some point soon-ish. Would you prefer there be no indication of this?
The linked issue also mentions (the lack of) alternatives.
zone.js is mentioned as an alternative in another similar question. Angular2 uses it heavily. (I have no personal experience with zone.js in Node.js.)