router

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogRoutes

func LogRoutes(r *chi.Mux, logger *slog.Logger)

LogRoutes logs routing on Debug level when server is ONLINE

func Setup

func Setup(middlewares ...func(http.Handler) http.Handler) *chi.Mux

Setup a new go-chi router

Types

type Endpoint

type Endpoint struct {
	Middlewares []func(http.Handler) http.Handler
	Handler     http.HandlerFunc
}

Endpoint ...

type EndpointPattern

type EndpointPattern struct {
	Pattern   string
	Endpoints map[string]Endpoint
}

EndpointPattern ...

type HTTPRouter

type HTTPRouter interface {
	Route(*chi.Mux) error
}

HTTPRouter ...

type Route

type Route struct {
	Middlewares []func(http.Handler) http.Handler
	Endpoints   []EndpointPattern
	SubRoutes   []SubRoute
}

Route ...

func New

func New(rt Route) *Route

New sets a Route

func (*Route) Build

func (rt *Route) Build(r *chi.Mux) (err error)

Build router

type SubRoute

type SubRoute struct {
	Pattern string
	Route   Route
}

SubRoute ...

Jump to

Keyboard shortcuts

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