aboutsummaryrefslogtreecommitdiff
path: root/utils/render.go
blob: 787c4536e8e712ca38249361759757b4eba00787 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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())
}