modules

package
v6.10.9-aug.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package modules provides a pluggable routing module system for extending the API server with optional features without modifying core routing logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterModule

func RegisterModule(ctx Context, mod any) error

RegisterModule registers a module using the RouteModuleV2 interface.

Example usage:

ctx := modules.Context{
    Engine:         engine,
    BaseHandler:    baseHandler,
    Config:         cfg,
    AuthMiddleware: authMiddleware,
}
if err := modules.RegisterModule(ctx, ampModule); err != nil {
    log.Errorf("Failed to register module: %v", err)
}

Types

type Context

type Context struct {
	Engine         *gin.Engine
	BaseHandler    *handlers.BaseAPIHandler
	Config         *config.Config
	AuthMiddleware gin.HandlerFunc
}

Context encapsulates the dependencies exposed to routing modules during registration. Modules can use the Gin engine to attach routes, the shared BaseAPIHandler for constructing SDK-specific handlers, and the resolved authentication middleware for protecting routes that require API keys.

Directories

Path Synopsis
Package amp implements the Amp CLI routing module, providing OAuth-based integration with Amp CLI for ChatGPT and Anthropic subscriptions.
Package amp implements the Amp CLI routing module, providing OAuth-based integration with Amp CLI for ChatGPT and Anthropic subscriptions.

Jump to

Keyboard shortcuts

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