router

package
v0.0.0-...-ad35ae5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package router for http request routing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	Verbose bool
	Prefix  string
	Routes  []route
	// contains filtered or unexported fields
}

Router ah http request router

func (*Router) Add

func (r *Router) Add(method string, path string, handler func(http.ResponseWriter, *http.Request, map[string]string) error)

Add add a new route into the router routing table

func (Router) ServeHTTP

func (r Router) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP try to match a route to the request, and call the route handler

func (*Router) SetNext

func (r *Router) SetNext(h http.Handler)

SetNext sets the next handler in the routing list

Jump to

Keyboard shortcuts

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