router

package
v0.0.0-...-a50f772 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: BSD-3-Clause, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RepoPullAction   action = "pull"
	RepoPushAction   action = "push"
	SystemInfoAction action = "sysinfo"
)

Functions

This section is empty.

Types

type Route

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

Route represents an application route

type Router

type Router struct {
	*gin.Engine
	Logger          *cm_logger.Logger
	Routes          []*Route
	TlsCert         string
	TlsKey          string
	ContextPath     string
	BasicAuthHeader string
	AnonymousGet    bool
	Depth           int
}

Router handles all incoming HTTP requests

func NewRouter

func NewRouter(options RouterOptions) *Router

NewRouter creates a new Router instance

func (*Router) SetRoutes

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

SetRoutes applies list of routes

func (*Router) Start

func (router *Router) Start(port int)

type RouterOptions

type RouterOptions struct {
	Logger        *cm_logger.Logger
	Username      string
	Password      string
	ContextPath   string
	TlsCert       string
	TlsKey        string
	PathPrefix    string
	EnableMetrics bool
	AnonymousGet  bool
	Depth         int
	MaxUploadSize int
}

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