Runt

Source

About

Runt is a tiny Ruby web server. It uses WEBrick to serve HTML files in www/ .

Runt is taken from the given HTTP Server example.

Da Code

Also posted at Dzone Snippets.

#!/usr/bin/env ruby

require "webrick"

s=WEBrick::HTTPServer.new(
        :BindAddress => "localhost",
        :Port => 8080,
        :DocumentRoot => File.dirname($0)+"/"+"www/"
)

trap("INT") { s.shutdown }

s.start