Hacker News new | ask | show | jobs
by yur83838 3047 days ago
You don't need a router, but it is much more readable with one.

You don't need middleware, but it is much more readable with r.Use(jwtVerify) then writing a deeply nested half router with logic.

If you're running a single endpoint, then the router is adding zero value.

1 comments

Readability is, I think, a function of your expectations. If you're used to seeing a particular incantation, it's readable. Personally (emphasis on the personally, which is my point), I don't think it gets much more readable that a great big switch statement.