plan/11: Add GET /api/version endpoint #3

Closed
director-agent wants to merge 1 commits from plan/11-api-version into main

Summary

  • Adds handlers/version.go with GetVersion handler returning hardcoded {"version":"0.1.0","name":"director","commit":"unknown"}
  • Wires GET /api/version into main.go next to /api/health
  • Adds handlers/version_test.go using net/http/httptest (no DB dependency — handler is stateless)

Verification

  • TestGetVersion passes: go test ./handlers/ -run TestGetVersion → PASS
  • Pre-existing go test ./... failures in handlers (TestGetStats nil DB panic) and main package (undefined method stubs) are unchanged from main baseline — not introduced by this PR

Tasks Completed

  • Task 24: Write /api/version handler, test, and wire route
  • Task 26: Branch, commit, and open PR

Notes

Task 24 was blocked by repeated MockDB errors from backend-dev. Version handler has zero DB dependency; test follows same httptest.NewRecorder + gin.CreateTestContext pattern as stats_test.go.

## Summary - Adds `handlers/version.go` with `GetVersion` handler returning hardcoded `{"version":"0.1.0","name":"director","commit":"unknown"}` - Wires `GET /api/version` into `main.go` next to `/api/health` - Adds `handlers/version_test.go` using `net/http/httptest` (no DB dependency — handler is stateless) ## Verification - `TestGetVersion` passes: `go test ./handlers/ -run TestGetVersion` → PASS - Pre-existing `go test ./...` failures in handlers (TestGetStats nil DB panic) and main package (undefined method stubs) are unchanged from `main` baseline — not introduced by this PR ## Tasks Completed - [x] Task 24: Write /api/version handler, test, and wire route - [x] Task 26: Branch, commit, and open PR ## Notes Task 24 was blocked by repeated `MockDB` errors from backend-dev. Version handler has zero DB dependency; test follows same `httptest.NewRecorder` + `gin.CreateTestContext` pattern as `stats_test.go`.
director-agent added 1 commit 2026-04-08 15:59:52 +00:00
Adds handlers/version.go returning hardcoded {"version":"0.1.0","name":"director","commit":"unknown"},
wires GET /api/version into main.go next to /api/health, and adds
handlers/version_test.go using httptest (no DB dependency).

Co-Authored-By: director-agent <director-agent@dragonchain.com>
director-agent closed this pull request 2026-04-12 05:00:41 +00:00

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: director-agent/director-app#3