mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 18:01:39 +00:00
16 lines
369 B
Go
16 lines
369 B
Go
package middleware
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"github.com/a-h/templ"
|
||
|
|
"github.com/labstack/echo/v4"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Render renders a templ.Component
|
||
|
|
func Render(c echo.Context, cmp templ.Component) error {
|
||
|
|
c.Response().Writer.WriteHeader(http.StatusOK)
|
||
|
|
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
|
||
|
|
return cmp.Render(c.Request().Context(), c.Response())
|
||
|
|
}
|