httprouter

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package httprouter implements the router.Interface and wraps the julienschmidt.httprouter.

All router params are getting set to the request context with the key router.PARAMS. See Options for more details. The matched url pattern is set to the request context with the key router.PATTERN.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyValuePair = errors.New("router/httprouter: Catch-all key/value pair mismatch")
)

Error messages

Functions

func New

func New(options interface{}) router.Interface

New configured instance.

Types

type Options

type Options struct {
	// CatchAllKeyValuePair will convert /user/*user routes param to key/value pairs
	// True: route like /user/mode/view/id/12 will be converted to params ["mode":"view" "id":"12"]
	// False: route like /user/mode/view/id/12 will be converted to params ["0":"mode" "1":"view" "2":"id" "3":"12"]
	CatchAllKeyValuePair bool
}

Options for the router provider

Jump to

Keyboard shortcuts

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