Created
January 4, 2015 14:25
-
-
Save IQAndreas/99016ee3f3184f77da0d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 countdown = [ | |
"America has given us the monkey, and Mann Co. has provided the fuel. Let's put those two together and make history!", | |
"Attention! One minute left in the mission, one minute left in the mission.", | |
"The bomb is nearing a checkpoint.", | |
"We have recieved additional time.", | |
"Thirty seconds left.", | |
"Heavy: Why is no one pushing cart?", | |
"Twenty seconds remaining.", | |
"The bomb has almost reached the final terminus!", | |
"Ten seconds...", | |
"5... 4... 3... 2... 1...", | |
"Excellent! We have launched the rocket! We've--", | |
"Oh, no. Gentlemen, this never happened." | |
]; | |
var s = http.createServer(function(request, response) { | |
response.writeHead(200, { 'content-type': 'text/plain' }); | |
response.write("<pre>\n"); | |
response.write("Get to the cart!\n"); | |
var i = 0; | |
var intervalID = setInterval(function() { | |
response.write(countdown[i++] + "\n"); | |
if (i >= countdown.length) { | |
clearInterval(intervalID); | |
response.end("</pre>\n"); | |
} | |
}, 2000); | |
}); | |
s.listen(8000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment