Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (32 sloc) 0.837 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
require 'webmachine'

class RouteDebugResource < Webmachine::Resource
  def to_html
    <<-HTML
<html>
<head><title>Test from Webmachine</title></head>
<body>
<h5>request.disp_path</h5>
<pre>#{request.disp_path}</pre>
<h5>request.path_info</h5>
<pre>#{request.path_info}</pre>
<h5>request.path_tokens</h5>
<pre>#{request.path_tokens}</pre>
</body>
</html>
HTML
  end
end

MyApp = Webmachine::Application.new do |app|
  # Configure your app like this:
  app.configure do |config|
    config.port = 8888
    config.adapter = :WEBrick
  end
  # And add routes like this:
  app.add_route ['fizz', :buzz, '*'], RouteDebugResource
  # OR add routes this way:
  app.routes do
    add [:test, :foo, '*'], RouteDebugResource
  end
end

MyApp.run
Something went wrong with that request. Please try again.