middleware

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 17 Imported by: 0

README

Http Middleware

Doc Go Release Test Report Card Codecov License

Http Middleware for Goravel.

Version

goravel/http-middleware goravel/framework
v1.0.x v1.13.x

Install

  1. Add package
go get -u github.com/goravel/http-middleware
  1. Register service provider, make sure it is registered first.
// config/app.go
import "github.com/goravel/http-middleware"

"providers": []foundation.ServiceProvider{
    &middleware.ServiceProvider{},
    ...
}
  1. Use middleware in route
import "github.com/goravel/http-middleware"

facades.Route().Middleware(middleware.Cors()).Get("users", userController.Show)

For more information, please see document https://www.goravel.dev/the-basics/middleware.html.

Testing

Run command below to run test:

go test ./...

Documentation

Index

Constants

View Source
const (
	OpentracingTracer = "opentracing_tracer"
	OpentracingCtx    = "opentracing_ctx"
)

Variables

View Source
var (
	ConfigFacade      config.Config
	CacheFacade       cache.Cache
	RateLimiterFacade http.RateLimiter
)

Functions

func Cors

func Cors() httpcontract.Middleware

func Opentracing

func Opentracing(tracer opentracing.Tracer) http.Middleware

func Throttle

func Throttle(name string) httpcontract.Middleware

func Tls

func Tls(host ...string) httpcontract.Middleware

Types

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (receiver *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (receiver *ServiceProvider) Register(app foundation.Application)

Jump to

Keyboard shortcuts

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