htmgo/starter-template/partials/load/register.go

17 lines
331 B
Go
Raw Normal View History

package load
2024-09-12 02:06:34 +00:00
import (
"github.com/gofiber/fiber/v2"
2024-09-13 17:13:01 +00:00
"github.com/maddalax/mhtml/framework/h"
2024-09-12 02:06:34 +00:00
)
func RegisterPartials(f *fiber.App) {
f.All("/mhtml/partials*", func(ctx *fiber.Ctx) error {
partial := GetPartialFromContext(ctx)
if partial == nil {
return ctx.SendStatus(404)
}
return h.PartialView(ctx, partial)
})
}