router

package
v0.0.0-...-04ace94 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetField

func GetField(r *http.Request, index int) string

GetField returns the matched field at given index from the URL path

Types

type TableRouter

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

TableRouter is regexp table-based http router Inspired by https://github.com/benhoyt/go-routing/tree/master/retable

func (*TableRouter) AddRoute

func (tr *TableRouter) AddRoute(method, pattern string, handler http.Handler)

AddRoute adds given handler for route matching given pattern and method

func (*TableRouter) ServeHTTP

func (tr *TableRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

Serve routes the given request

Jump to

Keyboard shortcuts

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