Live data from Hacker News

Ask HN: Is there a project based book or course on Go for writing web APIs?

news.ycombinator.com

31–34 of 34 posts

Re: Ask HN: Is there a project based book or course on Go for writing web APIs?

#31
post #23

Earlier quoted context omitted.

Could you go into more detail about this? I'm using Gin currently and would like to avoid any potential landmines if possible.

I didn't like Gin because they don't let you use whatever routes you want. Something like /:category/:product and /user/:name (notice no ":") is not admissible because ":category" in the first route clashes with "user" in the second route (wtf?)

I've definitely been bitten by this and the work around is pretty hacky.

Re: Ask HN: Is there a project based book or course on Go for writing web APIs?

#32
post #11

If you're coming from Ruby, you might like Gin[0]. I'd also recommend learning to write web APIs with the standard library so you know the primitives. Writing Web Applications[1] on golang.org covers the basics. [0] https://github.com/gin-gonic/gin [1] https://golang.org/doc/articles/wiki

I've had a bad experience with Gin and when asking about alternatives in a local Go meetup I was given the advice to use https://github.com/go-chi/chi or gorilla/mux.

It's not super helpful to recommend alternatives without providing any reasoning. I've used all of the above and Gin has been fine for me for standard HTTP APIs. The exception is web sockets, but you can use gorilla/mux in conjunction with with Gin for that.

Re: Ask HN: Is there a project based book or course on Go for writing web APIs?

#33
post #11

If you're coming from Ruby, you might like Gin[0]. I'd also recommend learning to write web APIs with the standard library so you know the primitives. Writing Web Applications[1] on golang.org covers the basics. [0] https://github.com/gin-gonic/gin [1] https://golang.org/doc/articles/wiki

I've had a bad experience with Gin and when asking about alternatives in a local Go meetup I was given the advice to use https://github.com/go-chi/chi or gorilla/mux.

chi is nice in that it is just a router, not a whole framework. It uses the existing http middleware idioms from the standard library. If you want to route some incoming requests by url to handlers in go code, chi is pretty reasonable.

context: working in large org building backend services that speak to other backend services via various crappy http / rest / soap APIs.

Re: Ask HN: Is there a project based book or course on Go for writing web APIs?

#34

In https://www.manning.com/books/go-web-programming , they start with server-side rendered views and then dedicate the whole last part of the book to web services. It's pretty good!

At first I thought book was in Slovenian or something, until I realized there was some DOM level decryption happening. I simultaneously wanted to open it up to figure out how it worked and close the page because it was so broken and counter to the supposedly simple idea of displaying words on a page that it infuriated me. I hope the book is good, but I guess I'll never know.

Why is it infuriating? It gives you a preview before you have to purchase the book. What's wrong with that? If anything, it's better than some publishers.
Post reply on HN