Created
January 3, 2018 09:01
-
-
Save tcoupin/8679c87902792f6bc9a751b2b4cdbdcc to your computer and use it in GitHub Desktop.
Node app to print hostname, but slowly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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