by marcus_holmes · 8y ago · 0 comments
You don't need an ORM. Mapping database tables to objects directly is a really bad idea. Write SQL, it's easy, simple and cheap. Yes, you'll repeat yourself. Golang generally prefers some repetition to some dependency.
You don't need middleware. Once you get used to handling routes as logic, then the need for middleware kinda vanishes.
You can use the semi-official google websockets package [0]. It's borderline whether this could be considered part of the standard library or not (I use the google uuid package all the time for the same reason). I believe there's an intention to include these packages in the standard library at some point, probably Go v2.
Try it out, it's liberating.
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.
Community should better be saying try std library if you find it verbose try framework(router+ORM)
Those people should try being maintenance programmers sometime /curmudgeonly-grumble
I agree, but the point is that you can do this with just the "almost official" package. It's not like you have to use the gorilla package because there's no standard library package.