require "http/server" server = HTTP::Server.new do |context| sleep 50.seconds context.response.content_type = "text/plain" context.response.print "Hello world! The time is #{Time.local}\n" puts context.request.path.to_s end Signal::INT.trap do puts "server stopped" if !server.closed? server.close end end server.bind_tcp "0.0.0.0", 8080 puts "Listening on http://0.0.0.0:8080" server.listen