If I understand correctly, you're describing a simplified version of https://twistedmatrix.com/documents/current/web/howto/using-twistedweb.html which provides the concept of "path" by having a system that generates a graph of resource nodes than can be rendered. Routing to any specific endpoint is a matter of graph traversal until the system reaches a leaf node and calls a relevant HTTP method. It's a model I've used successfully in the past and found it to be enjoyable.
That being said, having access to easy-to-use, parameterized routes makes things much simpler IMO. It cleanly separates the logic required for resource graph traversal from the endpoint rendering. Having them combined was one of my major complaints about the "resource as a router" model. A large concept that this article also ignores is middleware. The decorator pattern is quite a powerful one and is facilitated by nearly every 3rd party mux implementation. Top level support for middleware makes adding decorators to some, or all, endpoint rendering resources an easy task regardless of the specific resource graph traversal required to activate them. The ability to take a single purpose, well tested endpoint and wrap it in other single purpose, well tested functionality (such as logging, stats, tracing, retries, backoffs, circuit breaking, authentication, etc.) without modifying the core logic of the endpoint is a large value add. It's unclear how the "resource as a router" model could easily provide such a feature. This is not to say it's impossible, I simply haven't seen it done well outside the mux model before. On Sun, Jun 18, 2017 at 5:02 PM 'Axel Wagner' via golang-nuts < golang-nuts@googlegroups.com> wrote: > Hey gophers, > > in an attempt to rein in the HTTP router epidemic, I tried writing down a) > why I think *any* router/muxer might not be a good thing to use (much > less write) and b) what I consider good, practical advice on how to route > requests instead. It's not rocket science or especially novel, but I wanted > to provide more useful advice than just saying "just use net/http" and > haven't seen that a lot previously. > > Feedback is welcome :) > http://blog.merovius.de/2017/06/18/how-not-to-use-an-http-router.html > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.