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>
18 lines
329 B
Go
18 lines
329 B
Go
package handlers
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
type VersionResponse struct {
|
|
Version string `json:"version"`
|
|
Name string `json:"name"`
|
|
Commit string `json:"commit"`
|
|
}
|
|
|
|
func (h *Handler) GetVersion(c *gin.Context) {
|
|
c.JSON(200, VersionResponse{
|
|
Version: "0.1.0",
|
|
Name: "director",
|
|
Commit: "unknown",
|
|
})
|
|
}
|