middlewares

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(opt CORSOpt) sgo.HandlerFunc

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

func DefaultSkipper

func DefaultSkipper(*sgo.Context) bool

DefaultSkipper returns false to execute this middleware for all pages.

func Gzip

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

Gzip compress.

func Logger

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

Logger implements SGo.Middleware's interface.

Types

type CORSOpt

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

CORSOpt is options of CORS middleware.

type Skipper

type Skipper func(*sgo.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