htmgo/partials/base.go

17 lines
305 B
Go
Raw Normal View History

2024-09-11 00:52:18 +00:00
package partials
2024-09-12 02:06:34 +00:00
import (
"github.com/gofiber/fiber/v2"
"mhtml/h"
)
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)
})
}