doecho

package module
v2.0.0-...-563b1fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Use

func Use(router *echo.Group, basePath string, injector do.Injector)

Use integrates the do library's web-based debugging interface with an Echo router. This function sets up HTTP routes for the debugging UI, allowing you to inspect your DI container through a web browser using the Echo framework.

Parameters:

  • router: The Echo router group to add the debugging routes to
  • basePath: The base URL path for the debugging interface
  • injector: The injector instance to debug

The function sets up the following routes:

  • GET /: The main debugging interface home page
  • GET /scope: Scope tree visualization with optional scope_id parameter
  • GET /service: Service inspection with optional scope_id and service_name parameters

Example:

e := echo.New()
api := e.Group("/api")
debug := e.Group("/debug/di")

// Add the debugging interface
doecho.Use(debug, "/debug/di", injector)

// Your application routes
api.GET("/users", userHandler)

The debugging interface will be available at /debug/di and provides:

  • Visual representation of scope hierarchy
  • Service dependency graphs
  • Service inspection and debugging tools
  • Navigation between different views

Security: Do not expose this group publicly in production. Protect it with authentication (e.g., Basic Auth) and/or network restrictions, since it reveals internals about your DI graph. Attach auth middleware to the Echo group before Use.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL