router

package
v0.0.0-...-7a5359b Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionPath = "/version"
	MetricsPath = "/metrics"
	LivePath    = "/live"
	ReadyPath   = "/ready"
	PprofPath   = "/debug/pprof"
)

other URLs

Variables

This section is empty.

Functions

func LiveHandler

func LiveHandler(c *gin.Context)

LiveHandler ...

func ReadHandler

func ReadHandler(c *gin.Context)

ReadHandler ...

func VersionHandler

func VersionHandler(c *gin.Context)

VersionHandler ...

Types

type Options

type Options struct {
	GinLogEnabled  bool
	GinLogSkipPath []string
	PprofEnabled   bool
	MetricsEnabled bool

	Addr             string
	MetricsSubsystem string
	MetricsPath      string
	ShutdownTimeout  time.Duration

	// 	Username      string
	// 	Password      string
	CertFilePath string
	KeyFilePath  string
}

Options are options for constructing a Router

type Profile

type Profile struct {
	Name string
	Href string
	Desc string
}

Profile ...

type Route

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

Route represents an application route

type Router

type Router struct {
	*gin.Engine
	Routes map[string][]*Route

	ProfileDescriptions []*Profile
	Opt                 *Options
	// contains filtered or unexported fields
}

Router handles all incoming HTTP requests

func NewRouter

func NewRouter(opt *Options) *Router

NewRouter creates a new Router instance

func (*Router) AddProfile

func (r *Router) AddProfile(method, href, desc string)

AddProfile ...

func (*Router) AddRoutes

func (r *Router) AddRoutes(apiGroup string, routes []*Route)

AddRoutes applies list of routes

func (*Router) DefaultRoutes

func (r *Router) DefaultRoutes() []*Route

DefaultRoutes ...

func (*Router) IndexHandler

func (r *Router) IndexHandler(c *gin.Context)

IndexHandler ...

func (*Router) Start

func (r *Router) Start(stopCh <-chan struct{}) error

Start ...

func (*Router) StartWarp

func (r *Router) StartWarp(stopCh <-chan struct{})

StartWarp ...

Jump to

Keyboard shortcuts

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