router

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route added in v0.5.0

type Route struct {
	Method  string
	Path    string
	Handler gin.HandlerFunc
	Action  string
}

Route represents an application route

type Router

type Router struct {
	*gin.Engine
	Logger          *cm_logger.Logger
	Authorizer      *cm_auth.Authorizer
	Routes          []*Route
	TlsCert         string
	TlsKey          string
	TlsCACert       string
	ContextPath     string
	Depth           int
	DepthDynamic    bool
	CORSAllowOrigin string
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	Host            string
	WebTemplatePath string
}

Router handles all incoming HTTP requests

func NewRouter

func NewRouter(options RouterOptions) *Router

NewRouter creates a new Router instance

func (*Router) SetRoutes added in v0.5.0

func (router *Router) SetRoutes(routes []*Route)

SetRoutes applies list of routes

func (*Router) Start added in v0.5.0

func (router *Router) Start(port int)

type RouterOptions added in v0.5.0

type RouterOptions struct {
	Logger                *cm_logger.Logger
	LogLatencyInteger     bool
	Username              string
	Password              string
	ContextPath           string
	TlsCert               string
	TlsKey                string
	TlsCACert             string
	PathPrefix            string
	LogHealth             bool
	EnableMetrics         bool
	AnonymousGet          bool
	Depth                 int
	MaxUploadSize         int
	BearerAuth            bool
	AuthRealm             string
	AuthService           string
	AuthCertPath          string
	AuthActionsSearchPath string
	DepthDynamic          bool
	ReadTimeout           int
	WriteTimeout          int
	CORSAllowOrigin       string
	Host                  string
}

RouterOptions are options for constructing a Router

Jump to

Keyboard shortcuts

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