httptreemux icon indicating copy to clipboard operation
httptreemux copied to clipboard

Question: will regexp routes be considered?

Open jxskiss opened this issue 4 years ago • 2 comments

Just a question, does regexp routes will be supported? Or if it's welcomed to accept PR to support regexp? Sometimes it's quite useful doing some migration work.

jxskiss avatar Oct 23 '21 10:10 jxskiss

Yeah, I can accept a PR for it if it can be done without disrupting the rest of the code too much.

Something interacting with wildcardChild, or maybe a new similar field for regexes, and doing a check around https://github.com/dimfeld/httptreemux/blob/ce8677cff45072010a99d509b1694ce1fcf21707/tree.go#L267 should work I think.

Also I believe the Chi router (https://github.com/go-chi/chi) already accepts regexp routes so that might be a better choice than this one.

dimfeld avatar Oct 27 '21 00:10 dimfeld

I will take a try to do some experimental work, if it looks not bad, I will send it for review and further discussing. Yes, I guess a new similar field like wildcardChild is a good start.

Also I believe the Chi router (https://github.com/go-chi/chi) already accepts regexp routes so that might be a better choice than this one.

I'm not familiar with it, I use Gin a lot and like the router, but miss regex route ability sometimes, but Gin and httprouter seems won't accept regex.

jxskiss avatar Oct 29 '21 15:10 jxskiss