kontor-echo: setup project to show homepage
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s
Gitea Actions Demo / build-and-test (push) Failing after 11s

This commit is contained in:
Thomas Peetz
2026-11-09 17:02:59 +01:00
parent 074abd3c85
commit debdf3d0b0
63 changed files with 2411 additions and 485 deletions
+33
View File
@@ -0,0 +1,33 @@
package handlers
import (
"kontor-api-echo/internal/globals"
"net/http"
"time"
"github.com/labstack/echo/v5"
)
func Health(c *echo.Context) error {
return c.JSON(200, map[string]string{
"ok": "true",
"status": "healthy",
"version": globals.Version,
"time": time.Now().UTC().Format(time.RFC3339),
})
}
func Index(c *echo.Context) error {
logger := c.Logger()
cookie, err := c.Cookie(globals.UserKey)
user := ""
if err != nil {
logger.Info("error reading cookie", "error", err.Error())
} else {
user = cookie.Value
}
logger.Info("IndexGetHandler", globals.UserKey, user)
data := globals.GetDefaultValues(user, "This is an index page...")
return c.Render(http.StatusOK, "home", data)
}