tiny-routes icon indicating copy to clipboard operation
tiny-routes copied to clipboard

Add a path-template matcher implementation to emulate Sinatra's splat parameters

Open jeko2000 opened this issue 2 years ago • 0 comments

Sinatra allows matching against splat or wildcard parameters.

Per their docs:

get '/say/*/to/*' do
  # matches /say/hello/to/world
  params['splat'] # => ["hello", "world"]
end

get '/download/*.*' do
  # matches /download/path/to/file.xml
  params['splat'] # => ["path/to/file", "xml"]
end

It may be useful to write a path-template matcher implementation to emulate this behavior.

jeko2000 avatar Mar 23 '22 22:03 jeko2000