23 lines
558 B
Go
23 lines
558 B
Go
|
package web
|
||
|
|
||
|
import (
|
||
|
log "git.tijl.dev/tijl/tijl.dev/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)) {
|
||
|
commonFunctions = append(commonFunctions, function)
|
||
|
}
|
||
|
|
||
|
func Common(c *fiber.Ctx) *fiber.Map {
|
||
|
theMap := &fiber.Map{}
|
||
|
for _, function := range commonFunctions {
|
||
|
function(c, theMap)
|
||
|
}
|
||
|
log.Debug().Interface("theMap", theMap).Interface("commonFunctions", commonFunctions).Msg("yo")
|
||
|
return theMap
|
||
|
}
|