router

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthCheck

func HealthCheck(ctx *gin.Context)

HealthCheck handles the health check functionality by logging a message and returning "pong" as the response.

Types

type Router

type Router struct {
	Engine *gin.Engine
	Cfg    config.File
}

Router is a small builder around gin.Engine to assemble middlewares and routes without leaking application-specific logic into this package.

func NewRouter

func NewRouter(cfg config.File) *Router

NewRouter creates a new Router builder with a fresh gin.Engine.

func (*Router) Build

func (r *Router) Build() *gin.Engine

Build returns the underlying gin.Engine.

func (*Router) WithBackchannel

func (r *Router) WithBackchannel(setup func(*gin.Engine)) *Router

WithBackchannel registers the backchannel API endpoints via the provided setup function.

func (*Router) WithFrontend

func (r *Router) WithFrontend(setupHydra, setup2FA, setupWebAuthn, setupNotify func(*gin.Engine)) *Router

WithFrontend calls the provided setup functions to register the frontend pages.

func (*Router) WithHealth

func (r *Router) WithHealth(handler gin.HandlerFunc) *Router

WithHealth registers the health endpoint using the given handler.

func (*Router) WithMetricsMiddleware

func (r *Router) WithMetricsMiddleware() *Router

WithMetricsMiddleware enables Prometheus request metrics middleware.

func (*Router) WithMetricsRoute

func (r *Router) WithMetricsRoute(handler gin.HandlerFunc) *Router

WithMetricsRoute registers the GET /metrics handler provided by the caller.

func (*Router) WithRecovery

func (r *Router) WithRecovery() *Router

WithRecovery adds gin.Recovery middleware to recover from panics.

func (*Router) WithRequestDecompression

func (r *Router) WithRequestDecompression() *Router

WithRequestDecompression installs request decompression middlewares (gzip, zstd, br).

func (*Router) WithResponseCompression

func (r *Router) WithResponseCompression() *Router

WithResponseCompression applies response compression according to server config.

func (*Router) WithStatic

func (r *Router) WithStatic(setup func(*gin.Engine)) *Router

WithStatic runs the provided setup function to add static routes.

func (*Router) WithTrustedProxies

func (r *Router) WithTrustedProxies() *Router

WithTrustedProxies configures the trusted proxies for the underlying engine.

Jump to

Keyboard shortcuts

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