This commit is contained in:
Eden Kirin
2024-02-05 22:30:11 +01:00
commit c0f161abe1
26 changed files with 2480 additions and 0 deletions

16
app/handlers/render.go Normal file
View File

@ -0,0 +1,16 @@
package handlers
import (
"github.com/a-h/templ"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/adaptor"
)
// example taken from https://github.com/a-h/templ/tree/main/examples/integration-gofiber
func Render(c *fiber.Ctx, component templ.Component, options ...func(*templ.ComponentHandler)) error {
componentHandler := templ.Handler(component)
for _, o := range options {
o(componentHandler)
}
return adaptor.HTTPHandler(componentHandler)(c)
}