Server-Side Scripting/Introduction/Ruby
app.rb
edit# Displays "Hello world!"
#
# References:
# https://en.wikipedia.org/wiki/WEBrick
require 'webrick'
server = WEBrick::HTTPServer.new(:Port => 8000)
server.mount_proc('/') do |request, response|
response.body = "Hello world!"
end
trap("INT") {server.shutdown}
server.start
Try It
editCopy and paste the code above into the following free online development environment or use your own Ruby compiler / interpreter / IDE.