MCPcopy
hub / github.com/angular/angular / requestHandler

Function requestHandler

packages/zone.js/simple-server.js:21–43  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

19}
20
21function requestHandler(req, res) {
22 if (req.url === '/close') {
23 res.end('server closing');
24 setTimeout(() => {
25 process.exit(0);
26 }, 1000);
27 } else {
28 const file = path.resolve(localFolder, req.url);
29 if (!file.startsWith(localFolder + '/')) {
30 writeNotFound(res);
31 return;
32 }
33
34 fs.readFile(file, function (err, contents) {
35 if (!err) {
36 res.end(contents);
37 } else {
38 writeNotFound(res);
39 return;
40 }
41 });
42 }
43}
44
45server = http.createServer(requestHandler).listen(8080);

Callers

nothing calls this directly

Calls 6

setTimeoutFunction · 0.85
writeNotFoundFunction · 0.85
endMethod · 0.65
resolveMethod · 0.65
readFileMethod · 0.65
exitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…