We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5fb8978 commit c947929Copy full SHA for c947929
doc/api/stream.md
@@ -67,16 +67,15 @@ var server = http.createServer( (req, res) => {
67
// the end event tells you that you have entire body
68
req.on('end', () => {
69
try {
70
- var data = JSON.parse(body);
+ const data = JSON.parse(body);
71
+ // write back something interesting to the user:
72
+ res.write(typeof data);
73
+ res.end();
74
} catch (er) {
75
// uh oh! bad json!
76
res.statusCode = 400;
77
return res.end(`error: ${er.message}`);
78
}
-
- // write back something interesting to the user:
- res.write(typeof data);
79
- res.end();
80
});
81
82
0 commit comments