MCPcopy
hub / github.com/gofiber/fiber / FromContext

Function FromContext

middleware/session/middleware.go:245–251  ·  view source on GitHub ↗

FromContext returns the Middleware from the Fiber context. It accepts fiber.CustomCtx, fiber.Ctx, *fasthttp.RequestCtx, and context.Context. Parameters: - c: The Fiber context. Returns: - *Middleware: The middleware object if found; otherwise, nil. Usage: m := session.FromContext(c)

(ctx any)

Source from the content-addressed store, hash-verified

243//
244// m := session.FromContext(c)
245func FromContext(ctx any) *Middleware {
246 if m, ok := fiber.ValueFromContext[*Middleware](ctx, middlewareContextKey); ok {
247 return m
248 }
249
250 return nil
251}
252
253// Set sets a key-value pair in the session.
254//

Calls

no outgoing calls