How to have dynamic or a regexp in my URL with net/http

I don’t want to use Gorilla/mux cuz some people say that it has a slower performance, which is a thing I’m trying to avoid.
So how can i achive this “page/{pageTitle}/{pageId}/HelloWorld” With net/http package only (without gorilla mux)?

1 Like

Please check following link to get the idea
https://husobee.github.io/golang/url-router/2015/06/15/why-do-all-golang-url-routers-suck.html

1 Like

slower performance use repexp, open source Mainstream router httprouer,chi, mux,

Performance time consuming httprouter 3 chi 14, mux 100+.

Don’t pay too much attention to router performance in general projects. Compared with other operations, routers consume less resources.

In the router implementation, there are two implementations based on radix and for loops. Compared with the for loop series, the radix series has natural high performance. In addition, repexp operations will consume a lot of resources during verification.

my router example: https://github.com/eudore/erouter.

Chinese implementation doc: https://github.com/eudore/eudore/wiki/4.5.1-eudore-router-radix

benchmakr: https://github.com/eudore/web-framework-benchmark

1 Like

I think I will stick with HttpRouter from your other answer, It’s actually faster than the builtin mux. Thanks so much!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.