MCPcopy Index your code
hub / github.com/nodejs/node / handler

Function handler

test/parallel/test-async-hooks-execution-async-resource-await.js:22–28  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

20}).enable();
21
22async function handler(req, res) {
23 executionAsyncResource()[sym] = { state: req.url };
24 await sleep(10);
25 const { state } = executionAsyncResource()[sym];
26 res.setHeader('content-type', 'application/json');
27 res.end(JSON.stringify({ state }));
28}
29
30const server = createServer(function(req, res) {
31 handler(req, res);

Calls 4

executionAsyncResourceFunction · 0.85
setHeaderMethod · 0.80
sleepFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected