router

package
v0.0.0-...-f9eb975 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrNoServerToShutdown

type ErrNoServerToShutdown struct{}

func (*ErrNoServerToShutdown) Error

func (e *ErrNoServerToShutdown) Error() string

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc gin.HandlerFunc
}

type Router

type Router struct {
	*gin.Engine
	Logger      *logger.Logger
	Routes      []*Route
	BasePath    string
	HTTPServer  *http.Server
	HTTPSServer *http.Server
}

func NewRouter

func NewRouter(options RouterOptions) *Router

NewRouter creates a new router

func (*Router) SetRoutes

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

SetRoutes sets the routes for the router and registers them in the gin engine

func (*Router) Shutdown

func (r *Router) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server without interrupting any active connections

func (*Router) Start

func (r *Router) Start(nonTLSport int, localOnly bool, isTLS bool, domain string) error

Start starts the server

type RouterOptions

type RouterOptions struct {
	Logger   *logger.Logger
	BasePath string
}

Jump to

Keyboard shortcuts

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