require "http/server" require "uri" server = HTTP::Server.new(8080) { |context| sleep 50.seconds context.response.content_type = "text/plain" context.response.print "Hello world! The time is #{Time.now}\n" } Signal::HUP.trap do puts "Will stop in moment!" server.close end puts "Listening on http://127.0.0.1:8080 #{server.port}" server.listen