eddanger (owner)

Revisions

gist: 38213 Download_button fork
public
Description:
Call "Hello World" through Rack from Merb
Public Clone URL: git://gist.github.com/38213.git
Embed All Files: show embed
/config/rack.rb #
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
class HelloWorld
  def initialize(app)
    @app = app
  end
  
  def call(env)
    request = Merb::Request.new(env)
    if request.path =~ %r{/hello(.*)}
      [200, {"Content-Type" => "text/html"},
        "Hello Rack!"]
    else
      @app.call(env)
    end
    
  end
end
 
if prefix = ::Merb::Config[:path_prefix]
  use Merb::Rack::PathPrefix, prefix
end
 
use Merb::Rack::Static, Merb.dir_for(:public)
 
use HelloWorld
 
run Merb::Rack::Application.new