Server-Side Scripting/Introduction/Ruby

From Wikiversity
Jump to navigation Jump to search

app.rb[edit | edit source]

# Displays "Hello world!"
# References:

require 'webrick'
server = => 8000)

server.mount_proc('/') do |request, response|
    response.body = "Hello world!"

trap("INT") {server.shutdown}


Try It[edit | edit source]

Copy and paste the code above into the following free online development environment or use your own Ruby compiler / interpreter / IDE.

See Also[edit | edit source]