gorilla/mux ? reverse-engineered prompt

Reverse engineered prompt

Build me a small Go package that acts like a powerful HTTP router for web servers.

I want to be able to register routes for different paths, and also match on things like host, path prefix, query values, headers, HTTP methods, and even custom checks. It should support path variables like /articles/{category}/{id} and let handlers read those values easily. I also want nested route groups so I can define shared rules once, like all routes under a host or under /api, and then add more routes inside that group.

It should work as a normal http.Handler, so I can plug it into a Go server without any extra glue. Please include support for middleware, static file serving, and building URLs back from route names or variables. Add a few example tests or example usages too, especially for common things like route variables, CORS, authentication middleware, and serving a simple site or API. If you need to check current Go docs while building it, go ahead.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab