Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View lorem-ipsum-with-random-delay.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Service that reply lorem ipsum text after 200ms delay.
// Its performance should be ennough for needs of our benchmark.
 
var http = require('http')
var fs = require('fs')
 
var loremIpsum = fs.readFileSync('./lorem-ipsum.txt')
var random = function(max){return Math.floor((max + 1) * Math.random())}
 
http.createServer(function(req, res){
var delay = random(400)
console.log('delay: ' + delay)
setTimeout(function(){res.end(loremIpsum)}, delay)
}).listen(4000)
 
console.log('lorem ipsum server started on 4000 port')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.