mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
28 lines
835 B
Go
28 lines
835 B
Go
package api
|
|
|
|
import (
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
// RouteFn is an optional side-car wirer for API routes that don't ship
|
|
// in-tree — typically sub-modules like luxfi/cevm which would
|
|
// otherwise transitively pull heavy deps (geth, warp, etc.) into consumers
|
|
// that don't need them.
|
|
type RouteFn func(r *zip.Group, args ...zip.Handler)
|
|
|
|
var extraRoutes []RouteFn
|
|
|
|
// RegisterRoute wires an additional route function. The parent api.Route
|
|
// invokes every registered function after its own wiring is done. Consumers
|
|
// who want the route must blank-import the sub-module (e.g.
|
|
// `import _ "github.com/hanzoai/commerce/luxfi/cevm/api"`).
|
|
func RegisterRoute(fn RouteFn) {
|
|
extraRoutes = append(extraRoutes, fn)
|
|
}
|
|
|
|
func applyExtraRoutes(r *zip.Group, args ...zip.Handler) {
|
|
for _, fn := range extraRoutes {
|
|
fn(r, args...)
|
|
}
|
|
}
|