router

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRPCEndpoint = "/api"
	FormKeyParams      = "params"
	FormKeyMeta        = "meta"
)
View Source
const (
	DefaultRESTBasePath = "/api"
)

Variables

View Source
var Module = fx.Module(
	"vef:api:router",
	fx.Provide(
		fx.Annotate(
			func(chain *middleware.Chain) api.RouterStrategy {
				return NewRPC(DefaultRPCEndpoint, chain)
			},
			fx.ResultTags(`group:"vef:api:router_strategies"`),
		),
		fx.Annotate(
			func(chain *middleware.Chain) api.RouterStrategy {
				return NewREST(DefaultRESTBasePath, chain)
			},
			fx.ResultTags(`group:"vef:api:router_strategies"`),
		),
	),
)

Functions

func NewREST

func NewREST(basePath string, chain *middleware.Chain) api.RouterStrategy

NewREST creates a new RESTful router.

func NewRPC

func NewRPC(path string, chain *middleware.Chain) api.RouterStrategy

NewRPC creates a new RPC-style router. If path is empty, defaults to "/api".

Types

type REST

type REST struct {
	// contains filtered or unexported fields
}

REST implements api.RouterStrategy for RESTful routing.

func (*REST) CanHandle

func (*REST) CanHandle(kind api.Kind) bool

func (*REST) Name

func (*REST) Name() string

func (*REST) Route

func (r *REST) Route(handler fiber.Handler, op *api.Operation)

Route registers an operation with the router.

func (*REST) Setup

func (r *REST) Setup(router fiber.Router) error

type RPC

type RPC struct {
	// contains filtered or unexported fields
}

RPC implements api.RouterStrategy for RPC-style single endpoint routing.

func (*RPC) CanHandle

func (*RPC) CanHandle(kind api.Kind) bool

func (*RPC) Name

func (*RPC) Name() string

func (*RPC) Route

func (r *RPC) Route(handler fiber.Handler, op *api.Operation)

func (*RPC) Setup

func (r *RPC) Setup(router fiber.Router) error

Jump to

Keyboard shortcuts

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