Files
kontor/kontor-gin/pkg/controllers/handlers.go
T
Thomas Peetz 044da5353a
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
add templates for kontor-gin
2026-09-22 19:19:51 +02:00

25 lines
539 B
Go

package controllers
import (
"kontor-api-gin/pkg/globals"
"net/http"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/slog"
"github.com/gin-gonic/gin"
)
func IndexGetHandler(c *gin.Context) {
session := sessions.Default(c)
user := session.Get(globals.UserKey)
logger := slog.Get(c)
logger.Info("IndexGetHandler", "user", user)
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"title": "Kontor Gin",
"version": "0.4.0",
"content": "This is an index page...",
"logout": globals.LogoutUrl,
"user": user,
})
}