package main import ( "net/http" "erius.ru/passwd-mgr/components" "github.com/a-h/templ" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" ) func Render(ctx echo.Context, statusCode int, t templ.Component) error { buf := templ.GetBuffer() defer templ.ReleaseBuffer(buf) if err := t.Render(ctx.Request().Context(), buf); err != nil { return err } return ctx.HTML(statusCode, buf.String()) } func main() { e := echo.New() e.Static("/assets", "assets") e.Use(middleware.Logger()) e.GET("/", func(c echo.Context) error { return Render(c, http.StatusOK, components.Index()) }) e.Logger.Fatal(e.Start(":8080")) }