1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| var http = require("http"); var sleep = require('system-sleep');
var server = http.createServer(function (req, res) { var requestBody = ""; req.on('data', function(chunk) { requestBody += chunk; });
req.on('end', function() { var request = req.method + " " + req.url + "\n\n";
var hrTime = process.hrtime(); request += (hrTime[0] * 1000000 + hrTime[1] / 1000); request += "\n\n";
res.setHeader('Content-Type', 'application/json'); res.setHeader('X-QUOTA', '100'); res.setHeader('Access-Control-Allow-Origin','*');
if (req.url != "/") { console.log(request); } if (req.url != "/no-end-response"){ res.end(request); } });
req.on('error', function(err) { console.log(err); }); }); server.listen(9999); server.timeout = 400000
|