Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7f75542

Browse files
Minor optimizations
1 parent 4959819 commit 7f75542

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎JavaScript/goodServer.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const http = require('http');
44

5+
const PORT = 8000;
6+
57
const me = { name: 'jura', age: 22 };
68

79
const routing = {
@@ -12,7 +14,7 @@ const routing = {
1214
};
1315

1416
const types = {
15-
object: o=>JSON.stringify(o),
17+
object: JSON.stringify,
1618
string: s => s,
1719
undefined: () => 'not found',
1820
function: (fn, req, res) => fn(req, res) + '',
@@ -24,4 +26,4 @@ http.createServer((req, res) => {
2426
const serializer = types[type];
2527
const result = serializer(data, req, res);
2628
res.end(result);
27-
}).listen(8000);
29+
}).listen(PORT);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /