Skip to content
Create a gist now

Instantly share code, notes, and snippets.

// 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)
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.