Tectu / malloy

A cross-platform C++20 library providing embeddable server & client components for HTTP and WebSocket.
BSD 3-Clause "New" or "Revised" License
66 stars 8 forks source link

Support capture groups in route regex #12

Closed 0x00002a closed 3 years ago

0x00002a commented 3 years ago

Taken from: #10

Would be nice if the regex route supported capture groups, maybe passed in as a vector (to the handler function). Currently I'm doing my own parsing of the request's target in order to grab the bits I need from it. Could wrap the version without the extra args in a lambda before storing it or something.

0x00002a commented 3 years ago

I can do this one quite easily building on: #14. Without any needing to wrap it either, have it as a bool in the template for endpoint_regex and then std::conditional on the function type for the handler. As a bonus this means the capture group can be skipped for handlers which don't use it, don't pay for what you don't use and all that.

Tectu commented 3 years ago

14 was merged - wanna create a PR for this?