Rack: URL Mapping

Hi,

I am trying to write two kind of Rake routes. As we can see, Rake allow
us to write such routes as instance:

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 work well, but… I don’t know how to add ‘/’ path (as alternative
of ‘/index’ path). The path ‘/*’ is not interpreted as a joker,
according to my tests. Do you know how I could do?

Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs