There was an error while loading. Please reload this page.
1 parent dc06546 commit 4937fafCopy full SHA for 4937faf
1 file changed
JavaScript/3-http.js
@@ -19,15 +19,17 @@ const types = {
19
undefined: () => 'not found',
20
};
21
22
-http.createServer(async (req, res) => {
23
- const handler = routing[req.url];
24
- if (!handler) {
25
- res.end('Handler not found');
26
- return;
27
- }
28
- const data = await handler(req, res);
29
- const type = typeof data;
30
- const serializer = types[type];
31
- const result = serializer(data);
32
- res.end(result);
33
-}).listen(port);
+http
+ .createServer(async (req, res) => {
+ const handler = routing[req.url];
+ if (!handler) {
+ res.end('Handler not found');
+ return;
+ }
+ const data = await handler(req, res);
+ const type = typeof data;
+ const serializer = types[type];
+ const result = serializer(data);
+ res.end(result);
34
+ })
35
+ .listen(port);
0 commit comments