add tysc handlers to kontor-gin

This commit is contained in:
2026-09-30 04:12:03 +02:00
parent c848758821
commit f912dcb670
100 changed files with 2420 additions and 1064 deletions
+34
View File
@@ -0,0 +1,34 @@
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)
c.HTML(http.StatusOK, "home", gin.H{
"title": "Kontor Gin",
"version": "0.4.0",
"message": "This is an index page...",
"user": user,
})
}