echo-todos/helper.go
Alexilator 1d6fb15060
Some checks failed
Build Docker Image / build (push) Failing after 4m43s
cleanup and update
2025-01-30 22:58:27 +01:00

20 lines
405 B
Go

package main
import (
"context"
"net/http"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
func render(ctx echo.Context, status int, t templ.Component) error {
ctx.Response().Writer.WriteHeader(status)
err := t.Render(context.Background(), ctx.Response().Writer)
if err != nil {
return ctx.String(http.StatusInternalServerError, "failed to render response template")
}
return nil
}