echo-todos/helper.go
Alexilator 4fac3fbfa3
Some checks failed
Build Docker Image / build (push) Failing after 6m38s
public setup
2024-08-19 14:56:20 +02:00

21 lines
438 B
Go

package main
import (
"context"
"net/http"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
_ "github.com/mattn/go-sqlite3"
)
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
}