I'm trying to capture all requests to /dav
and all paths nested under that to a Rack handler:
match "/dav" => RackDAV::Handler.new(:root => 'davdocs')
match "/dav/*whatever" => RackDAV::Handler.new(:root => 'davdocs')
Do I really have to mak开发者_高级运维e two routes for this, or is there a way to express this as one route (one line)?
I think it should be enough to use
match "/dav(/*whatever)" => RackDAV::Handler.new(:root => 'davdocs')
Optional parameters are very briefly described in the Rails Routing guide under "Bound parameters"
match '/dav(/*dav_section)', :to => Proc.new { |env| [200, {"Content-Type" => 'text/plain'},["Here we are in Dav"]]}
精彩评论