ruby - Wildcard route in Grape -
i'm having issues getting grape respond purely wild card route.
by mean if have simple route defined
get ... end
i need respond potential requests made api. situation being need parse path , params , work through decision tree based on values.
i've tried few variations on route definition, such as:
get '/*' ... end '/(*)' ... end
but no avail.
i know there support regular expressions , route anchoring in grape, i've had no luck figuring out.
thanks!
you close guess @ syntax, need name matching param:
e.g.
'*thing' { :thing => params[:thing] } end
using *
make param capture rest of uri path, ignoring /
separators. otherwise behaves other param.
note pickup within rack mount point @ best, if have
prefix 'api' version 'v2'
then respond paths /api/v2/hkfhqk/fwggw/ewfewg
if using custom 404 or other catch-all routes, need add @ end, otherwise mask more specific routes.
Comments
Post a Comment