aboutsummaryrefslogtreecommitdiff
path: root/utils/render.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/render.go')
-rw-r--r--utils/render.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/render.go b/utils/render.go
new file mode 100644
index 0000000..787c453
--- /dev/null
+++ b/utils/render.go
@@ -0,0 +1,15 @@
+package utils
+
+import (
+ "net/http"
+
+ "github.com/a-h/templ"
+ "github.com/labstack/echo/v4"
+)
+
+func Render(c echo.Context, cmp templ.Component) error {
+ c.Response().WriteHeader(http.StatusOK)
+ c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8)
+
+ return cmp.Render(c.Request().Context(), c.Response())
+}