chore: initial commit of Go API gateway
CI / Test (push) Canceled after 0s
CI / Vet (push) Canceled after 0s
CI / Build (push) Canceled after 0s
CI / Security (govulncheck) (push) Canceled after 0s

Baseline for the Kong replacement on api.riotpiao.com. Brings the working
tree under version control for the first time: gateway source, the task
board that drives the agent runs, test fixtures, and K8s manifests.

Anchor the gateway ignore rule to the repo root. Unanchored, "gateway"
also matched the cmd/gateway/ source directory, so the program entrypoint
was excluded from every commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Story Crater Bot
2026-08-19 20:54:34 -07:00
co-authored by Claude Opus 5
commit 058f11cf2b
109 changed files with 8992 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
package server
import (
"net/http"
)
// Router implements an HTTP handler that routes health endpoints
// and passes other requests to an upstream handler.
type Router struct {
healthChecker *HealthChecker
upstreamHandler http.Handler
}
// NewRouter creates a new router with health endpoints.
// Health endpoints (/healthz and /readyz) are handled locally.
// All other paths are passed to the upstream handler.
func NewRouter(healthChecker *HealthChecker, upstreamHandler http.Handler) *Router {
return &Router{
healthChecker: healthChecker,
upstreamHandler: upstreamHandler,
}
}
// ServeHTTP implements http.Handler.
// It routes /healthz and /readyz to health handlers,
// and passes all other paths to the upstream handler.
func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
switch req.URL.Path {
case "/healthz":
LivenessHandler(r.healthChecker)(w, req)
case "/readyz":
ReadinessHandler(r.healthChecker)(w, req)
default:
r.upstreamHandler.ServeHTTP(w, req)
}
}