/middleware

The middleware packages for the Iris web framework.

Primary LanguageGo

Repository information

This Repository contains all middleware for the Iris web framework.

You can contribute also, just make a pull request, try to keep conversion, configuration file: './mymiddleware/config.go' & middleware: './mymiddleware/mymiddleware.go'.

Middleware is just handler(s) which served before the main handler.

How can I install a middleware?

$ go get -u github.com/iris-contrib/middleware/$FOLDERNAME

NOTE: When you install one middleware you will have all of them downloaded & installed, no need to re-run the go get foreach middeware.

How can I register middleware?

To a single route

iris.Get("/mypath",myMiddleware1,myMiddleware2,func(ctx *iris.Context){}, func(ctx *iris.Context){},myMiddleware5,myMainHandlerLast)

To a party of routes or subdomain

myparty := iris.Party("/myparty", myMiddleware1,func(ctx *iris.Context){},myMiddleware3)
{
	//....
}

To all routes

iris.UseFunc(func(ctx *iris.Context){}, myMiddleware2)

To global, all routes on all subdomains on all parties

iris.MustUseFunc(func(ctx *iris.Context){}, myMiddleware2)