Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacement for Domain in Nodejs?

Tags:

I have read many threads related to this but they are a little bit old now, that's why as Domain is still Deprecated till now has anyone found any other good alternative to using Domain or not ??

I read this post alternative-to-domain-in-nodejs and there i found zone.js, does anybody use it as domain alternative or not ?? Because as the last commit on this library was 3 years ago that's why I don't think it will be a reliable solution ??

like image 989
Sudhanshu Gaur Avatar asked Mar 26 '18 14:03

Sudhanshu Gaur


2 Answers

Domain isn't deprecated yet, it's pending deprecation; it won't be propery deprecated until there's a replacement. From the documentation:

This module is pending deprecation. Once a replacement API has been finalized, this module will be fully deprecated. Most end users should not have cause to use this module. Users who absolutely must have the functionality that domains provide may rely on it for the time being but should expect to have to migrate to a different solution in the future.

Note that last bit:

Users who absolutely must have the functionality that domains provide may rely on it for the time being...

So in terms of a replacement: Watch that page. The new API will be announced and the deprecation notice updated, presumably.

like image 165
T.J. Crowder Avatar answered Sep 21 '22 12:09

T.J. Crowder


zone.js now move to angular package, you can found it here, https://github.com/angular/zone.js.

And it can work in node.js, you can find detailed information here.

https://github.com/angular/zone.js/blob/master/MODULE.md https://github.com/angular/zone.js/blob/master/NON-STANDARD-APIS.md

you can try the new version, zone.js provide some features that domain doesn't have. please tell me when you need more information.

like image 42
jiali passion Avatar answered Sep 21 '22 12:09

jiali passion