Commit 2f94a9f5 authored by Joshua Lambert's avatar Joshua Lambert

Update server.rb

parent f5690e06
require 'webrick'
require 'securerandom'
server = WEBrick::HTTPServer.new :Port => 5000
#The following proc is used to customize the server operations
server.mount_proc '/' do |request, response|
response.body = 'Hello, world!'
response.body = 'Hello, improved world!'
sleep SecureRandom.random_number
end
server.mount_proc '/error' do |request, response|
response.status = 500
response.body = 'Sorry we encountered an error.'
sleep 1.0+SecureRandom.random_number
end
server.start
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment