Files
digital-psychology/apps/api/cmd/server/main.go
T
jackyu66gitandCursor 2fb1dfee14 chore: seal Design Vision v1 and monorepo scaffold
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>
2026-08-02 16:00:44 +08:00

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)
}
}