16 lines
386 B
Go
16 lines
386 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"github.com/a-h/templ"
|
||
|
"github.com/gofiber/fiber/v2"
|
||
|
"github.com/gofiber/fiber/v2/middleware/adaptor"
|
||
|
)
|
||
|
|
||
|
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)
|
||
|
}
|