github.com/lingyao2333/mo-zero@v1.4.1/rest/types.go (about)

     1  package rest
     2  
     3  import (
     4  	"net/http"
     5  	"time"
     6  )
     7  
     8  type (
     9  	// Middleware defines the middleware method.
    10  	Middleware func(next http.HandlerFunc) http.HandlerFunc
    11  
    12  	// A Route is a http route.
    13  	Route struct {
    14  		Method  string
    15  		Path    string
    16  		Handler http.HandlerFunc
    17  	}
    18  
    19  	// RouteOption defines the method to customize a featured route.
    20  	RouteOption func(r *featuredRoutes)
    21  
    22  	jwtSetting struct {
    23  		enabled    bool
    24  		secret     string
    25  		prevSecret string
    26  	}
    27  
    28  	signatureSetting struct {
    29  		SignatureConf
    30  		enabled bool
    31  	}
    32  
    33  	featuredRoutes struct {
    34  		timeout   time.Duration
    35  		priority  bool
    36  		jwt       jwtSetting
    37  		signature signatureSetting
    38  		routes    []Route
    39  		maxBytes  int64
    40  	}
    41  )