Skip to content

Instantly share code, notes, and snippets.

@tcoupin
Created January 3, 2018 09:01
Show Gist options
  • Save tcoupin/8679c87902792f6bc9a751b2b4cdbdcc to your computer and use it in GitHub Desktop.
Save tcoupin/8679c87902792f6bc9a751b2b4cdbdcc to your computer and use it in GitHub Desktop.
Node app to print hostname, but slowly
var http = require("http");
var os = require("os");
var timePerRequest = 0
setInterval(function(){
timePerRequest-=100;
if (timePerRequest<0){
timePerRequest=0;
}
},
100);
http.createServer(function(request, response) {
timePerRequest+=100;
setTimeout(function(){
response.end(os.hostname());
inprogress=false;
},timePerRequest)
}).listen(80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment