Files
nginx-unit/test/node/mirror/app.js
Valentin Bartenev 7fd9444728 Node.js: returning "this" from writeHead() to allow chaining.
In Node.js version 11.10.0 and later, the writeHead() function returns "this".
2019-08-06 16:24:11 +03:00

13 lines
314 B
JavaScript
Executable File

#!/usr/bin/env node
require('unit-http').createServer(function (req, res) {
let body = '';
req.on('data', chunk => {
body += chunk.toString();
});
req.on('end', () => {
res.writeHead(200, {'Content-Length': Buffer.byteLength(body)})
.end(body);
});
}).listen(7080);