feat(http): implement main HTTP server with health endpoints #140
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!140
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/http-server"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement the main HTTP server in
internal/httpapi:/healthz(#59) — liveness endpoint, returns200 {"status":"ok"}/readyz(#60) — readiness endpoint, returns200 {"status":"ready"}; backed by an atomic readiness flag (always ready for now, ready to be driven by dependency state later)NewRouter()keepsgin.Logger()+gin.Recovery()middlewarecmd/thwap-pagesd/main.gonow starts the HTTP server:http.Serverlistening on the configuredlistener.addressTests: httptest-based coverage for
/healthz,/readyz, and 404 on unknown routes.Why
Phase 5 task #61 — the HTTP server that the registration API (#69), webhook receiver (#75), and status API (#78) build on.
Testing
go build ./...go vet ./...go test -race ./internal/httpapi/— 3 tests passgofmt -l ./cmd ./internal ./pkgcleangolangci-lint run— 0 issuesBreaking Changes
None.
Notes
/readyzflag is currently hardcoded ready; it will be driven by service readiness in later phases.Closes #59
Closes #60
Closes #61
Review Summary
Verified locally on the PR head (
2dab711):go build,go vet,go mod verify,gofmt,golangci-lint runall clean; all 3 httpapi tests pass with-race. Also smoke-tested the binary:/healthz→200 {"status":"ok"},/readyz→200 {"status":"ready"}, unknown route →404, and SIGTERM triggers a clean graceful shutdown (log + exit 0).The server wiring is correct —
http.Serverbound to the configured listener,signal.NotifyContexthandling SIGINT/SIGTERM, and a 10s boundedShutdown. The/readyzatomic flag is a sensible placeholder that's ready to be driven by dependency state later.No blocking issues.
Non-blocking observations:
readyflag is local toNewRouterand always true with no external setter yet — fine as a placeholder, but it will need to move into a shared readiness type when services drive it (later phases).Logger()middleware writes request logs to stdout while the rest of the app logs through zap — the recurring mixed-logging note; worth wiring gin into the zap logger eventually.ListenAndServeactually binds — trivial ordering nit.Approving.