We break down a practical “Go way” to clean HTTP handlers: we move the routine (statuses, headers, JSON encoding, a single error format) into a shared adapter, and leave the handlers focused “on the meaning”. We build an error contract via
ValidationError and
HTTPError, write single response points
writeJSON/
writeError (with
errors.As), and wire everything up through a function type with a
ServeHTTP method.