feat: initialize license platform implementation
Some checks failed
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Add the Go Gin backend skeleton, Vue frontend shell, health check, CI workflow, implementation docs, and static review demo.\n\nCo-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-09-30 14:30:36 +08:00
commit 3ab651d3a8
23 changed files with 3440 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package httpapi
import (
"net/http"
"github.com/gin-gonic/gin"
)
func NewRouter() *gin.Engine {
r := gin.New()
r.Use(gin.Logger(), gin.Recovery())
r.GET("/api/v1/health/live", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"status": "ok"})
})
return r
}

View File

@@ -0,0 +1,28 @@
package httpapi
import (
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
)
func TestLiveness(t *testing.T) {
w := httptest.NewRecorder()
NewRouter().ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/api/v1/health/live", nil))
if w.Code != http.StatusOK {
t.Fatalf("status = %d, want 200", w.Code)
}
var body struct{ Status string `json:"status"` }
if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil || body.Status != "ok" {
t.Fatalf("body = %q, err = %v", w.Body.String(), err)
}
}
func TestUnknownRoute(t *testing.T) {
w := httptest.NewRecorder()
NewRouter().ServeHTTP(w, httptest.NewRequest(http.MethodGet, "/api/v1/licenses", nil))
if w.Code != http.StatusNotFound {
t.Fatalf("status = %d, want 404", w.Code)
}
}