router

package
v2.0.14+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

type Route struct {
	Path        string
	Pattern     *regexp.Regexp
	Method      string
	Accepts     string
	HandlerFunc http.HandlerFunc
}

Route is the mapping to a request made to the server

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router handles the routing of the web server

func New

func New() *Router

New creates a new Router

func (*Router) AddHandler

func (ro *Router) AddHandler(rh RoutesHandler)

AddHandler adds the routes handler routes to the router

func (*Router) ServeHTTP

func (ro *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves any request to the corresponding handler

type Routes

type Routes []Route

Routes is a slice of Routes

type RoutesHandler

type RoutesHandler interface {
	Routes() Routes
}

RoutesHandler is any object that has routes

Jump to

Keyboard shortcuts

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