middlewares

package
v0.0.0-...-3013a29 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(opt CORSOpt) sweetygo.HandlerFunc

CORS returns a Cross-Origin Resource Sharing (CORS) middleware.

func DefaultSkipper

func DefaultSkipper(*sweetygo.Context) bool

DefaultSkipper returns false to execute this middleware for all pages.

func Gzip

func Gzip(level int, skipper Skipper) sweetygo.HandlerFunc

Gzip compress.

func JWT

func JWT(store, key string, skipper Skipper) sweetygo.HandlerFunc

JWT implements sweetygo.HandlerFunc.

func Logger

func Logger(out io.Writer, skipper Skipper) sweetygo.HandlerFunc

Logger implements SweetyGo.Middleware's interface.

Types

type CORSOpt

type CORSOpt struct {
	Skipper      Skipper
	AllowOrigins []string
	AllowMethods []string
}

CORSOpt is options of CORS middleware.

type Skipper

type Skipper func(*sweetygo.Context) bool

Skipper defines your own function to skip a middleware. Returning true to skip.

Jump to

Keyboard shortcuts

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