gpt4 book ai didi

javascript - 为什么 Node.js 中不推荐使用域 API?

转载 作者:IT老高 更新时间:2023-10-28 22:04:38 26 4
gpt4 key购买 nike

为什么是 domain API在 Node.js 中已弃用?

我发现在传入 Web 请求的上下文中捕获错误而不是异常沸腾到进程级别很方便。

另外,现在可以使用域 API 的替代品吗?

最佳答案

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.

如果我们反过来说。我们知道域名必须离开,并且 很快就必须在某个时候删除。你喜欢那里吗 没有任何迹象?

链接的问题还提到(缺乏)替代方案。

关于javascript - 为什么 Node.js 中不推荐使用域 API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33552400/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com