tijl.dev-core/modules/web/common.go
tijl fea80ba467
All checks were successful
build / build (push) Successful in 33s
updates
2024-08-22 15:15:16 +02:00

23 lines
528 B
Go

package web
import (
log "git.tijl.dev/tijl/tijl.dev-core/modules/logger"
"github.com/gofiber/fiber/v2"
)
var commons *fiber.Map = &fiber.Map{}
var commonFunctions []func(*fiber.Ctx, *fiber.Map)
func RegisterCommon(function func(*fiber.Ctx, *fiber.Map)) {
log.Debug().Msg("web.RegisterCommon: registered a function")
commonFunctions = append(commonFunctions, function)
}
func Common(c *fiber.Ctx) *fiber.Map {
theMap := &fiber.Map{}
for _, function := range commonFunctions {
function(c, theMap)
}
return theMap
}