0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00
nodejs/test_http.js
Ryan 478e45a32f Change request handler to take two parameters: req, res.
This is more semantic, albeit unnecessary, usage. I think users will
be able to remember the API more easily.
2009-05-18 12:44:01 +02:00

8 lines
222 B
JavaScript

new node.http.Server(function (req, res) {
setTimeout(function () {
res.sendHeader(200, [["Content-Type", "text/plain"]]);
res.sendBody("Hello World");
res.finish();
}, 1000);
}).listen(8000, "localhost");