Full Go backend + Vue 3 frontend, OpenAI-compatible API, multi-provider account pools, billing/admin, Docker one-command deploy with auto HTTPS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
26 lines
554 B
Go
26 lines
554 B
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"backend/internal/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type SiteHandler struct {
|
|
site *service.SiteService
|
|
}
|
|
|
|
func NewSiteHandler(site *service.SiteService) *SiteHandler {
|
|
return &SiteHandler{site: site}
|
|
}
|
|
|
|
func (h *SiteHandler) Public(c *gin.Context) {
|
|
title, err := h.site.Title(c.Request.Context())
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"detail": "failed to load site"})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, gin.H{"title": title, "contact": h.site.Contact(c.Request.Context())})
|
|
}
|