pistache icon indicating copy to clipboard operation
pistache copied to clipboard

is it possible to have route that matches a regular wildcard (or an arbitrary number of splats)?

Open zokroj opened this issue 5 years ago • 3 comments

Hello, is it possible to have a route that matches a wildcard (or as an alternative an arbitrary number of splats)? In other words I would like to have a route:

mytest/*

that matches anything after *. For example: mytest/part1 mytest/part1/part2

Thanks

zokroj avatar Jan 20 '20 14:01 zokroj

Hi the routes in Pistache is defined static, you can add these type of paths by interpreter or wrappers with your own implementation... This is not supported in this library by default

mohsenomidi avatar Jan 20 '20 15:01 mohsenomidi

You could hook into the undefined route handler.

m_router.addNotFoundHandler(Rest::Routes::bind(handleNotFound));

dennisjenkins75 avatar Jan 20 '20 22:01 dennisjenkins75

@dennisjenkins75 or @oktal, do you know if it's possible to bind a callback for any OPTIONS endpoint? I tried...

Routes::Options(myrouter, "/*", ...);

But this returns Method Not Allowed to the client when they try OPTIONS /some/thing/blah.

kiplingw avatar Jan 12 '22 03:01 kiplingw