# cat config.ru
require "roda"

class App < Roda
  use Rack::Session::Cookie, secret: ENV['SECRET']

  route do |r|
    # matches any GET request
    r.get do

      # matches GET /
      r.is "" do
        r.redirect "/hello"
      end

      # matches GET /hello or GET /hello/.*
      r.on "hello" do

        # matches GET /hello/world
        r.is "world" do
          "Hello world!"
        end

        # matches GET /hello
        r.is do
          "Hello!"
        end
      end
    end
  end
end

run App.app

Roda

Routing Tree
Web Framework

Roda is a new ruby web framework, allowing for fast and DRY code using a routing tree. Find out why you should use it.