Skip to content

Instantly share code, notes, and snippets.

@madhums madhums/req.js
Created Jun 26, 2014

Embed
What would you like to do?
var http = require('http')
var i = 0;
var j = 0;
// write data to request body
setInterval(function(){
console.log('\n');
i = i + 1;
console.log('Sending request: ' + i);
http.get("http://localhost:3000", function(res) {
j = j + 1;
console.log("Got response: " + j);
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.