
Design and Build a JSON API in Go That Stays Maintainable
Build a JSON API in Go from a written contract: standard routing, one error format, strict decoding, validation, cursor paging, PATCH, auth and tests.
Everything you need to level up your coding skills.

Build a JSON API in Go from a written contract: standard routing, one error format, strict decoding, validation, cursor paging, PATCH, auth and tests.

Test templ components with golden HTML files and an update flag, add structural checks that parse the output with x/net/html, and read a failure message.

Test Go middleware one piece at a time with a spy handler, then test the whole chain for order, short circuits, panics, headers and context values.

Call handlers directly with httptest.NewRecorder and NewRequest, set path values by hand, fake the store behind them, and assert on status, headers and JSON.

Use httptest.NewServer to stand in for an upstream API in Go tests: scripted responses, slow servers for timeouts, TLS servers and request recording.
We send one email when a new article is published. No spam.