Files
kontor/kontor-gin/internal/handlers/kontor.go
T
Thomas Peetz 2889927416
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / build-and-test (push) Failing after 2m49s
change templates
2026-10-25 04:05:11 +01:00

30 lines
646 B
Go

package handlers
import (
"kontor-api-gin/internal/globals"
"net/http"
"time"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/slog"
"github.com/gin-gonic/gin"
)
func Health(c *gin.Context) {
c.JSON(200, gin.H{
"ok": true,
"status": "healthy",
"version": globals.Version,
"time": time.Now().UTC().Format(time.RFC3339),
})
}
func Index(c *gin.Context) {
session := sessions.Default(c)
user := session.Get(globals.UserKey)
logger := slog.Get(c)
logger.Info("IndexGetHandler", globals.UserKey, user)
data := globals.GetDefaultValues(user, "This is an index page...")
c.HTML(http.StatusOK, "home", data)
}