middlewares

package
v0.0.0-...-f513fc6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(credentials map[string]string) contracts.ThenableFunc

BasicAuth provides basic-auth middleware.

credentials = map[string]string{
	"username": "password",
}

m.Use(mango.BasicAuth(credentials))

func Compress

func Compress() contracts.ThenableFunc

Compress compress response data.

func Cors

Cors additional CORS middleware

func Record

func Record() contracts.ThenableFunc

Record log incoming requests to console.

func Recovery

func Recovery() contracts.ThenableFunc

Recovery record every panic.

func Redirect

Redirect recirects requests.

func Static

Static serve static assets

func Throttle

func Throttle(qps int) contracts.ThenableFunc

Throttle controls how much request frequency from remote client is allowed.

Types

type CorsOption

type CorsOption struct {
	Origin  string
	Methods string
	Headers string
}

CorsOption configure the cors middleware.

type RedirectOption

type RedirectOption struct {
	MustHTTPS bool
	MustHOST  string
}

RedirectOption configures HTTPS Redirector.

type StaticOption

type StaticOption struct {
	Path string
	Root http.FileSystem
}

StaticOption configuration of Static middleware.

Jump to

Keyboard shortcuts

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