Graceful shutdown done right
We had dropped requests during deploys. The shutdown lesson fixed it the same afternoon.
Browse
Build a clean, fast JSON API with the Go standard library: routing, middleware, PostgreSQL, context, testing and graceful shutdown
Created by Leila Haddad
Go is a popular language for backend services. It compiles to a single binary, starts instantly, handles many concurrent connections well and has a standard library that covers most of what an API needs. Since Go 1.22, the built in router supports HTTP methods and path parameters, so many teams now build services with no web framework at all.
This course teaches you to build a production style JSON API with idiomatic Go. We build Lendr, a small service for tracking items lent to friends, with users, items, loans and reminders.
net/http and the enhanced ServeMux patternscontext for timeouts and cancellationlog/slogYou already program in another language, such as Python, JavaScript or Java, and you know the basics of Go syntax, or are willing to pick them up quickly with the short refresher in section one. You understand HTTP and SQL at a basic level.
The focus is on clarity: small functions, explicit errors and code your teammates can read. We avoid clever abstractions and keep dependencies to a minimum.
iOS and backend engineer teaching SwiftUI apps and the Go services behind them
I work on both ends of mobile products: the iOS app in Swift and SwiftUI, and the backend services, which I usually write in Go. Seeing both sides has made me picky about clean APIs, clear error handling and code that a teammate can read a year later.
My courses are calm and structured. We start with the smallest working version, then add one concept at a time, with a short recap at the end of every section.
When I am not building, I contribute small fixes to open source Go libraries and help run a local meetup for mobile developers.
We had dropped requests during deploys. The shutdown lesson fixed it the same afternoon.
I did not realise how far the standard library had come. The new ServeMux patterns cover everything we needed.
Writing plain SQL and getting typed Go functions is the best of both worlds. Great section.
Leila's code is very readable. I wanted a bit more on authentication with external identity providers.
The cancellation demo with a slow query made context click for me.
Table driven tests with httptest are now how our team tests every handler.
If you are new to Go, the refresher lesson moves fast. I paused to do the Go tour first.