feat(api): GET /api/tracks/{id} handler with parent metadata
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,3 +23,12 @@ func writeErr(w http.ResponseWriter, status int, code, message string) {
|
||||
w.WriteHeader(status)
|
||||
_ = json.NewEncoder(w).Encode(errorBody{Error: errorPayload{Code: code, Message: message}})
|
||||
}
|
||||
|
||||
// writeJSON emits a 2xx response with the given body JSON-encoded. Mirrors
|
||||
// writeErr's shape so handlers have one shape for success and one for
|
||||
// failure.
|
||||
func writeJSON(w http.ResponseWriter, status int, body any) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(status)
|
||||
_ = json.NewEncoder(w).Encode(body)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user