feat: start on backend #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "0-backend-creation"
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?
Changes Requested
HTTP_ADDRor CLI flag) with default:8080and use it inbackend/cmd/server/main.goinstead of hardcoding.backend/internal/config/config.goto (a) join missing env keys with ", " for readability, and (b) include an optionalHTTP_ADDRsetting (or clearly document thatmainprovides it). Ensure.env.exampledocumentsHTTP_ADDR.Server.Rundoc comment to say it blocks until the providedctxis canceled (signals) and that graceful shutdown uses a 10s timeout; consider renaming toServe(optional).Summary of Changes
backend/cmd/server/main.gowithslogand signal-backed context.Serverinbackend/internal/server/server.gowith route registration and/healthhandler; graceful shutdown and a 10s timeout implemented.backend/internal/config/config.gousinggodotenvand collating missing env vars into a single error.backend/go.mod,backend/go.sum,.env.example, updated CI workflow, and docs updates (CONTRIBUTING.md, specs, etc.).Overall Feedback
Negative: The current change hardcodes the HTTP listen address and uses a terse missing-vars message. Before merging, please make the listen address configurable (env var
HTTP_ADDRor a small flag), surfaceHTTP_ADDRin.env.exampleor inSettings, and make the missing-vars join use ", " so errors are easy to read.Positive: The backend scaffold is well-structured. Use of
slog, signal-backed context, and a clear server abstraction with graceful shutdown are strong foundations. CI and docs updates are thoughtful and helpful — nice work! 🎉Please address the three requested changes and push an update; I'll re-review the patch once those items are resolved. Thanks!
@Pertempto — backend/cmd/server/main.go: please wire up signal-based shutdown so
Runcan exit via a canceled context instead ofcontext.Background()which blocks forever.Actionable change (suggestion): use
signal.NotifyContext(oros/signal+context.WithCancel) and pass that ctx intosrv.Run. Minimal example:Also consider making the listen address configurable (env var or flag) instead of hardcoding
:8080.File:
backend/internal/server/server.gow.Writeerror in the/healthhandler (currently ignored). At minimum, check the return value and log it. Example inside a handler with access to a logger:Serverreceiver (e.g.func (s *Server) registerRoutes()) so handlers can uses.loggerfor error logging. This makes the health handler more robust and debuggable.Tagging @Pertempto for visibility.
File:
backend/internal/config/config.goHTTP_ADDR(orADDR) as an optional config key or document thatmainprovides defaults. If you prefer to keepHTTP_ADDRout ofSettings, explicitly note in the comment thatLoadonly validates DB envs.", "for readability (e.g.strings.Join(missing, ", ")) — currently you use","as the separator which yields no space between names.