Home / File/ expvar.go — fiber Source File

expvar.go — fiber Source File

Architecture documentation for expvar.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Adapters 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  6b3e42fe_8225_b307_8ede_972b4d23b95c["expvar.go"]
  4809913a_4bc9_08d2_f6bd_d40ce1eb7266["strings"]
  6b3e42fe_8225_b307_8ede_972b4d23b95c --> 4809913a_4bc9_08d2_f6bd_d40ce1eb7266
  style 6b3e42fe_8225_b307_8ede_972b4d23b95c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

package expvar

import (
	"strings"

	"github.com/gofiber/fiber/v3"
	"github.com/valyala/fasthttp/expvarhandler"
)

// New creates a new middleware handler
func New(config ...Config) fiber.Handler {
	// Set default config
	cfg := configDefault(config...)

	// Return new handler
	return func(c fiber.Ctx) error {
		// Don't execute middleware if Next returns true
		if cfg.Next != nil && cfg.Next(c) {
			return c.Next()
		}

		path := c.Path()
		// We are only interested in /debug/vars routes
		if len(path) < 11 || !strings.HasPrefix(path, "/debug/vars") {
			return c.Next()
		}
		if path == "/debug/vars" {
			expvarhandler.ExpvarHandler(c.RequestCtx())
			return nil
		}

		return c.Redirect().To("/debug/vars")
	}
}

Domain

Subdomains

Functions

Dependencies

  • strings

Frequently Asked Questions

What does expvar.go do?
expvar.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in expvar.go?
expvar.go defines 1 function(s): New.
What does expvar.go depend on?
expvar.go imports 1 module(s): strings.
Where is expvar.go in the architecture?
expvar.go is located at middleware/expvar/expvar.go (domain: FiberCore, subdomain: Adapters, directory: middleware/expvar).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free