MCPcopy Index your code
hub / github.com/restify/node-restify / handleWithDomain

Function handleWithDomain

lib/server.js:42–58  ·  view source on GitHub ↗
(req, res, onError, next)

Source from the content-addressed store, hash-verified

40// It has significant negative performance impact
41// Warning: this feature depends on the deprecated domains module
42function handleWithDomain(req, res, onError, next) {
43 // In Node v12.x requiring the domain module has a negative performance
44 // impact. As using domains in restify is optional and only required
45 // with the `handleUncaughtExceptions` options, we apply a singleton
46 // pattern to avoid any performance regression in the default scenario.
47 if (!domain) {
48 domain = require('domain');
49 }
50
51 var handlerDomain = domain.create();
52 handlerDomain.add(req);
53 handlerDomain.add(res);
54 handlerDomain.on('error', onError);
55 handlerDomain.run(function run() {
56 next(req, res);
57 });
58}
59
60///--- API
61

Callers

nothing calls this directly

Calls 1

nextFunction · 0.70

Tested by

no test coverage detected