Rack URL Mapping

Posted by Puru puru rin.. on Stack Overflow See other posts from Stack Overflow or by Puru puru rin..
Published on 2010-03-28T20:02:40Z Indexed on 2010/06/18 13:33 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

Hi,

I am trying to write two kind of Rack routes. Rack allow us to write such routes like so:

app = Rack::URLMap.new('/test'  => SimpleAdapter.new,
                       '/files' => Rack::File.new('.'))

In my case, I would like to handle those routes:

  • "/" or "index"
  • "/*" in order to match any other routes

So I had trying this:

app = Rack::URLMap.new('/index' => SimpleAdapter.new,
                       '/'      => Rack::File.new('./public'))

This works well, but... I don't know how to add '/' path (as alternative of '/index' path). The path '/*' is not interpreted as a wildcard, according to my tests. Do you know how I could do?

Thanks

© Stack Overflow or respective owner

Related posts about ruby

Related posts about httpwebrequest