mux

package
v0.0.0-...-d378361 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2017 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(h http.Handler) http.Handler

Logs requests

func NewRouter

func NewRouter(rootPath string) (*router, error)

Returns new router with root path == rootPath

func Params

func Params(req *http.Request) *params

Extracts "params" from request

func Wrap

func Wrap(h http.Handler, wrappers ...WrapperFunc) http.Handler

Wraps handler func with slice of wrapper functions one by one.

Types

type GetParams

type GetParams map[string]string

Get params stands for "query params"

type PathParams

type PathParams map[string]string

Example: url "/api/v1/users/599a49bacdf43b817eeea57b" and pattern `/api/v1/users/:id` path params = {"id": "599a49bacdf43b817eeea57b"}

type PostBody

type PostBody []byte // Byte array with request body

Type for http post body

type WrapperFunc

type WrapperFunc func(handlerFunc http.Handler) http.Handler

func Timeout

func Timeout(timeout time.Duration) WrapperFunc

Creates wrapper functions that adds timeout to requests

Jump to

Keyboard shortcuts

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