6 ms·
Ask HN: Is there a project based book or course on Go for writing web APIs?
I am in the process of learning go and i think something like Michael Hartl's Rails Tutorial would fit nicely for me right now. I've looked at usegolang.com but i am not sure it has emphasis on API's. Any suggestions?
- ryanstreur 7y agoIn https://www.manning.com/books/go-web-programming 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!
- totalthrowaway 7y agoAt 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.
- naikrovek 7y agoWhat do you mean you'll never know? Your parent comment said it was pretty good. A single data point is not authoritative, but it shows a pretty solid trend toward "pretty good." You already know the book is pretty good, you just wanted to complain about DRM, I suspect. I hope that's not the case.
- freehunter 7y agoEating rotten carrots is pretty good. A single data point is not authoritative, but my comment shows a pretty solid trend toward "pretty good." I expect you'll run out to go find some rotten carrots to eat now?
- naikrovek 7y agoIt's funny that you think that reading a book of unknown quality and eating a rotten carrot, which is guaranteed to be rotten, are comfortable in any way whatsoever.
- thinkmassive 7y agoThey have something like a 5-minute per-24h free preview of the entire book. It confused me too, the first time I came back to a tab I’d left open for a book I wanted to check out. Ultimately I wasn’t able to get a good idea of the book quality, so I never purchased a book from them, but maybe it works for some people.
- hazz99 7y agoWhy 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.
- deleted 7y ago[deleted]
- navd 7y agoNot a tutorial but here's a project that goes over the architecture of building one using best practices. You may not need everything in it (so take from it what you will), but it should be helpful: https://github.com/ardanlabs/service https://github.com/ardanlabs/service
- sequence7 7y agoI'm working through Let's Go! by Alex Edwards right now, it's not specifically focussed on APIs but the book guides you through building a web application in Go. My experience so far has been very positive. https://lets-go.alexedwards.net/ https://lets-go.alexedwards.net/
- dsincl12 7y agowell the structure is so so and everything is in package main in every file in every project.
- petercooper 7y agoI saw this recommended on HN the other day which covers that ground. Have not done it myself so this is a pointer rather than a recommendation: https://buildsaasappingo.com/ https://buildsaasappingo.com/
- dstpierre 7y agoHi, I'm Dominic the author of Build SaaS apps in Go, thank you for sharing the book website. If there's any questions please do not hesitate to ask. Here's a 25% discount direct buy link if that can help. https://store.dominicstpierre.com/build-saas-apps-in-go?coupon=TWITRLIMITED25 https://store.dominicstpierre.com/build-saas-apps-in-go?coup...
- tictoc 7y agoThat url...
- lignux 7y agoThanks, great suggestions in this thread. I ended up buying this
- yawz 7y agohttps://github.com/quii/learn-go-with-tests https://github.com/quii/learn-go-with-tests is a great resource. It has some relevant sections to writing Web APIs.
- bndw 7y agoIf 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 https://github.com/gin-gonic/gin [1] https://golang.org/doc/articles/wiki https://golang.org/doc/articles/wiki
- PhilippGille 7y agoI'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 https://github.com/go-chi/chi or gorilla/mux.
- IveForgotten 7y agoCould you go into more detail about this? I'm using Gin currently and would like to avoid any potential landmines if possible.
- biomcgary 7y agoI've used Gin for several small to medium projects without too much difficulty. I think Gin is a good way to learn quickly since its ecosystem introduces you to a lot of the pieces you will need. Personally, I don't do enough web development to grow out of it, since my web related projects are not a primary focus. One thing to note is that Gin's Context is not the standard context.Context, which some find problematic. Most (vocal?) Gophers prefer sticking with the standard library and Gorilla.
- bndw 7y agoIt's true that Gin's Context is different from context.Context, but I don't see how that's inherently problematic.
- ejefz 7y agoI 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?)
- PhilippGille 7y agoHaven't read through it myself, but I think it's noteworthy and it wasn't mentioned here yet: https://astaxie.gitbooks.io/build-web-application-with-golang/en/ https://astaxie.gitbooks.io/build-web-application-with-golan...
- gen220 7y agoSecond this, I've used this as a resource for ramping up medium-experience web developers in Go. It's great because it sticks to the `net/http` basics, and is fairly concise and blunt.
- dustinmr 7y agoI got an email about this book the other day: https://gumroad.com/l/kjHSa https://gumroad.com/l/kjHSa From the writer of this blog: https://www.thepolyglotdeveloper.com/ https://www.thepolyglotdeveloper.com/
- dandigangi 7y agoExcellent thread! Thanks all. Also in the process of getting GOing on Go. >:) (Yes, I am a geeky pun guy)
- ValentineC 7y agoI like Asta Xie's "Build Web Application with Golang" GitBook: https://astaxie.gitbooks.io/build-web-application-with-golang/en/ https://astaxie.gitbooks.io/build-web-application-with-golan... (Repo: https://github.com/astaxie/build-web-application-with-golang https://github.com/astaxie/build-web-application-with-golang)
- tmaly 7y agoIf you really want to get a good understanding of Go and web, I would work through building your own router see: https://vluxe.io/golang-router.html https://vluxe.io/golang-router.html For an example
- deleted 7y ago[deleted]
- segmondy 7y agohttps://gowebexamples.com/ https://gowebexamples.com/