go-proxy/api/router.go
Virgil e523fd0740 refactor(api): share monitoring route registration
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 16:45:13 +00:00

26 lines
790 B
Go

// Package api wires the monitoring endpoints onto an HTTP router.
//
// mux := http.NewServeMux()
// api.RegisterRoutes(mux, p)
package api
import (
"dappco.re/go/core/proxy"
)
// Router is the minimal route-registration surface used by RegisterRoutes.
type Router = proxy.RouteRegistrar
type SummaryResponse = proxy.SummaryResponse
type HashrateResponse = proxy.HashrateResponse
type MinersCountResponse = proxy.MinersCountResponse
type UpstreamResponse = proxy.UpstreamResponse
type ResultsResponse = proxy.ResultsResponse
// RegisterRoutes mounts the monitoring endpoints on any router with HandleFunc.
//
// mux := http.NewServeMux()
// api.RegisterRoutes(mux, p)
func RegisterRoutes(router Router, proxyValue *proxy.Proxy) {
proxy.RegisterMonitoringRoutes(router, proxyValue)
}