Archive the differentiated YuXinGu product docs, AI engineering system, design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity over early innovation (see .ai/product/STRATEGY.md). Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
954 B
Go
40 lines
954 B
Go
// Command server starts the 愈心谷 HTTP API.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/yuxingu/digital-psychology/apps/api/internal/config"
|
|
"github.com/yuxingu/digital-psychology/apps/api/internal/handler"
|
|
"github.com/yuxingu/digital-psychology/apps/api/internal/middleware"
|
|
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
|
)
|
|
|
|
func main() {
|
|
cfg := config.Load()
|
|
if cfg.AppEnv == "prod" {
|
|
gin.SetMode(gin.ReleaseMode)
|
|
}
|
|
|
|
r := gin.New()
|
|
r.Use(gin.Recovery(), gin.Logger(), middleware.RequestID())
|
|
|
|
api := r.Group("/api/v1")
|
|
handler.NewHealthHandler().Register(api)
|
|
|
|
// Placeholder route to demonstrate unified envelope.
|
|
api.GET("/ping", func(c *gin.Context) {
|
|
response.OK(c, gin.H{"pong": true})
|
|
})
|
|
|
|
addr := cfg.HTTPAddr
|
|
log.Printf("yuxingu api listening on %s env=%s", addr, cfg.AppEnv)
|
|
if err := r.Run(addr); err != nil {
|
|
log.Printf("server stopped: %v", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|